Reputation: 249
I am passing url as follows ...
Response.Redirect("~/all-media/books/?serachtext=on&off");
where serachtext is the only parameter. So, when I access this parameter as follows, it gives me only "on" as value.
Request.QueryString["searchtext"]
So, how can I solve this?
Upvotes: 0
Views: 817
Reputation: 65079
This won't work. The ampersand needs to be URL encoded.
The URL encoded value for an ampersand is %26
. SO you can do either:
a)
Response.Redirect("~/all-media/books/?serachtext=on%26off");
or b)
Response.Redirect("~/all-media/books/?serachtext=" + HttpUtility.UrlEncode("on&off"));
Upvotes: 5
Reputation: 700362
You should encode the value that you put in the query string:
Response.Redirect("~/all-media/books/?searchtext=" + Server.UrlEncode("on&off"));
Or do it manually:
Response.Redirect("~/all-media/books/?searchtext=on%26off");
Upvotes: 0