0

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

4

2 回答 2

1

您已经在标题中回答了这个问题......您需要在它进入您的 QueryString 之前对其进行 URL 编码,并在它返回时对其进行解码。

写:

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

读:

var encryptedResult = HttpUtility.UrlDecode(Request.QueryString["QueryString"]);
于 2013-07-20T17:30:35.733 回答
0

您可以将其用于 url 编码和解码。

string encodedUrl = HttpContext.Current.Server.UrlEncode(Request.QueryString["QueryString"]);
string decodedUrl = HttpContext.Current.Server.UrlDecode(encodedUrl);
于 2013-07-20T17:57:42.713 回答