query string problem
-
I'm using a query string in asp.net2.0 web application.I encrypt a string value and after encryption it becomes M8BIJqI+Sdc= and I send the value using query string.When I receive the value in another page using Request.Querystring method it comes as M8BIJqI Sdc=.The + symbol becomes a space .So I'm getting error during decryption. Anyone explain such behavior !!!!
-
I'm using a query string in asp.net2.0 web application.I encrypt a string value and after encryption it becomes M8BIJqI+Sdc= and I send the value using query string.When I receive the value in another page using Request.Querystring method it comes as M8BIJqI Sdc=.The + symbol becomes a space .So I'm getting error during decryption. Anyone explain such behavior !!!!
There are some characters that cannot be passed over querystring.For that you need to do URL endcoding as, for encoding
Server.UrlEncode
and decoding asServer.UrlDecode
. For details Have alookCheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
I'm using a query string in asp.net2.0 web application.I encrypt a string value and after encryption it becomes M8BIJqI+Sdc= and I send the value using query string.When I receive the value in another page using Request.Querystring method it comes as M8BIJqI Sdc=.The + symbol becomes a space .So I'm getting error during decryption. Anyone explain such behavior !!!!
Hi, Use Server.UrlEncode/ Server.UrlDecode to fix the issue,please check the following example:
string MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title=" + Server.UrlEncode("ASP.NET Examples");Response.Write("<a href=" + MyURL + "> ASP.NET Examples </a>");
string DecodedString = Server.UrlDecode(EncodedString);
Regards, Jamil
-
There are some characters that cannot be passed over querystring.For that you need to do URL endcoding as, for encoding
Server.UrlEncode
and decoding asServer.UrlDecode
. For details Have alookCheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
your welcome :)
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
you are welcome.
Regards, Jamil Check my latest Article :Silverlight - Html Host Control