Reputation: 1211
In my c# code I am encoding my Url that has multiple query strings. When at the receiver end I try to read back the query strings I get the null values (query string parameter is not found) reason being encoding changes &querystringparameter to &querystringparam. How to get around this.
Response.Redirect(HttpUtility.HtmlEncode("Add.aspx?ID=" + 1 + "&cid="+ 8 + "&jid=" +9));
On the add.aspx page i get the url as "add.aspx?id=1&sid=3&jid=9"
Upvotes: 2
Views: 15436
Reputation: 76444
Use HttpUtility.UrlEncode
, I bet it will work like a charm.
Read this article for more information.
Upvotes: 5
Reputation: 5501
The biggest issue is that you're encoding the whole query string. You need to encode the individual components, then concatenate them together.
Upvotes: 3