Get individual query parameters from Uri [duplicate]

Use this:

string uri = ...;
string queryString = new System.Uri(uri).Query;
var queryDictionary = System.Web.HttpUtility.ParseQueryString(queryString);

This code by Tejs isn’t the ‘proper’ way to get the query string from the URI:

string.Join(string.Empty, uri.Split('?').Skip(1));

Leave a Comment