How to read the query string params of a ASP.NET raw URL?
This is probably what you're after
Uri theRealURL = new Uri(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.RawUrl); string yourValue= HttpUtility.ParseQueryString(theRealURL.Query).Get("yourParm");
No need to go through the RawUrl
- the Request
object already contains a parsed version, using the Request.QueryString
property.
This is an indexed NameValueCollection
.
Try this:
string rawURL = HttpContext.Current.Request.ServerVariables["query_string"];