Is there a way to url encode the entire URL querystring without trying to urlencode each individual querystring parameters. Right now I’m having to rebuild the querystring with something like this:
foreach (string x in Page.Request.QueryString.Keys)
{
sQueryString += x + "=" + Server.UrlEncode(Request.Params.Get(x)) + "&";
}
All you should to do is to get the following value:
See:
Uri baseUri = new Uri("http://www.contoso.com/catalog/shownew.htm?date=today&<a>=<b>"); string queryString = baseUri.Query;The
queryStringparameter will return?date=today&%3Ca%3E=%3Cb%3E.One more edit - from the MSDN: