public static string ConstructQueryString(NameValueCollection paramCollection) { string result = string.Empty; StringBuilder stringBuilder = new StringBuilder(); foreach (object obj in paramCollection) { string text = (string)obj; stringBuilder.Append(XssEncode.UrlEncode(text) + "=" + XssEncode.UrlEncode(paramCollection[text]) + "&"); } if (stringBuilder.Length > 0) { result = stringBuilder.ToString(0, stringBuilder.Length - 1); } return(result); }
public static string UrlEncode(string input) { return(XssEncode.UrlEncode(input, Encoding.UTF8)); }