The HttpUtility.ParseQueryString method can be used to convert a query string to a NameValueCollection.
But there doesnt seem to be a method to convert a NameValueCollection to a Query String.
So here is a quick helper method to do just that:
static String ConstructQueryString(NameValueCollection parameters) { List<String> items = new List<String>(); foreach (String name in parameters) items.Add(String.Concat(name, "=", System.Web.HttpUtility.UrlEncode(parameters[name]))); return String.Join("&", items.ToArray()); }
No comments:
Post a Comment
Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.