Question

I have a some url data save in database that data is saved in as a encryption format like this below:

i.e: Wwrjf5OxVEznsWInNFwucg== 

that was okay but sum time encryption will be like this

i.e: Wwrjf5OxV+EznsWInNFwucg==

in that case when i read the Request.QueryString["QueryString"] or Request.Params["Params"]

then i will get the string with the space between encryption if there is a value with "+" between the encryption so how can i solve this issue of "+" in QueryString or Params read.

please let me know a batter solution for solve this issue

thank you

Was it helpful?

Solution 2

you can use this for url encode and decode.

string encodedUrl = HttpContext.Current.Server.UrlEncode(Request.QueryString["QueryString"]);
string decodedUrl = HttpContext.Current.Server.UrlDecode(encodedUrl);

OTHER TIPS

You've sort of already answered this question in your title... You need to URL-encode it before it goes into your QueryString and decode it when it comes back out.

Write:

Request.QueryString["QueryString"] = HttpUtility.UrlEncode(myEncryptedString);

Read:

var encryptedResult = HttpUtility.UrlDecode(Request.QueryString["QueryString"]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top