T tsteinke Jul 1, 2005 #1 Is there a function in C# to Build a Query String for an HttpRequest? Like from a NameValue Collection or something?
Is there a function in C# to Build a Query String for an HttpRequest? Like from a NameValue Collection or something?
J Joerg Jooss Jul 1, 2005 #2 Is there a function in C# to Build a Query String for an HttpRequest? Like from a NameValue Collection or something? Click to expand... If UTF-8 is acceptable as underlying encoding, Sytem.UriBuilder will do just fine. Cheers,
Is there a function in C# to Build a Query String for an HttpRequest? Like from a NameValue Collection or something? Click to expand... If UTF-8 is acceptable as underlying encoding, Sytem.UriBuilder will do just fine. Cheers,
B Bruce Barker Jul 2, 2005 #3 trival air code: public string BuildQueryString(NameValueCollection values) { StringBuilder sb = new StringBuilder(); for (i =0; i < values; ++ i) { sb.Append(i == 0 ? "?" : "&"); sb.Append(values.Keys); sb.Append("="); sb.Append(HttpUtility.UrlEncode(values)); } return sb.ToString(); } -- bruce (sqlwork.com)
trival air code: public string BuildQueryString(NameValueCollection values) { StringBuilder sb = new StringBuilder(); for (i =0; i < values; ++ i) { sb.Append(i == 0 ? "?" : "&"); sb.Append(values.Keys); sb.Append("="); sb.Append(HttpUtility.UrlEncode(values)); } return sb.ToString(); } -- bruce (sqlwork.com)