We can parse querystring and store the key value pair in a NameValueCollection collection.
// Dummy query string for example. string strQueryString = "Player=Roger Federer&Year=2012&Title=wimbledon"; // Parse the query string variables into a NameValueCollection. NameValueCollection nvcQueryString = HttpUtility.ParseQueryString(strQueryString); // Iterate through the collection. StringBuilder sbFormattesText = new StringBuilder("<br />"); foreach (string key in nvcQueryString.AllKeys) { sbFormattesText.Append(key + " : " + nvcQueryString[key] + "<br />"); } // Write the result to a label. lblQueryString.Text = sbFormattesText.ToString();
This is helpful when we have lot of querystring values.
http://msdn.microsoft.com/en-us/library/system.collections.specialized.namevaluecollection.aspx