I have parameter in the query string as type=Adults & Kids
http://localhost:32396/Account/StoreType?Success=1&type=Adults%20&%20Kids
When I read the Request["type"]… I get only Adults…
Do I need to encode the & symbol or there is a method to read?
You can do like this and redirect
"http://localhost:32396/Account/StoreType? " + Server.UrlEncode("Success=1&type=Adults%20&%20Kids")
Getting the values in another page
string values = Server.UrlDecode(Request.QueryString["type"]);
Hello Gautam,
You can use Server.URLEncode in the Code
"http://localhost:32396/Account/StoreType?Success=1&type=" + Server.URLEncode("Adults&Kids") + "";
Also while fetching the data on the next page you can use.
string queryString = Server.UrlDecode(Request.QueryString["Type"]);
Regards,
Sagar Shete
use UrlEncode method to encode type value
string success = "1"; string type = "Adults & Kids"; Response.Redirect("StoreType?Success=" + success + "&type=" + HttpUtility.UrlEncode(type));
You can read the value with same your previous code
string type = Request.QueryString["type"];
Hello,
simply remove the spaces:
http://localhost:32396/Account/StoreType?Success=1&type=AdultsKids