Saturday 15 May 2010

How to get a list of all the url parameters with their values in asp.net c#? -


In my asp.net c # solution, I want to get a dictionary of all the URL parameters, where the key is the parameter name and The value is the parameter value. How can I do this?

Thank you.

You HttpUtility.ParseQueryString Numeral Collection qscollection = HttpUtility.ParseQueryString (Querystring);

You can use it to get the queryring value yourself:

  Request.Url.Query   

Together it Numerology qscollection = HttpUtility.ParseQueryString (Request.Url.Query);

More information at

The hard manual method is without using the Biltine method:

  name value collection query parameters = new Name Value Acquisition (); String [] querySegments = queryString.Split ('& amp;'); Foreach (string segment in query segment) {string [] parts = segment .plit ('='); If (parts.Length & gt; 0) {string key = parts [0]. Trimurum (new four [] {'?', ''}); String val = parts [1]. Trim (); QueryParameters.Add (key, val); }}    

No comments:

Post a Comment