的Request.QueryString去除加密文本

问题描述:

人物在我的应用程序需要用户的电子邮件地址,加密,并且用urlencode它,一起将它传递到查询字符串。的Request.QueryString去除加密文本

email = Server.UrlEncode(aes.Encrypt(email)); 

着陆页做了的Request.QueryString [ “电子邮件”],UrlDecodes它,然后将其解密。

string email   = Server.UrlDecode(Request.QueryString["eId"]); 
    string decemail   = aes.Decrypt(email); 
    return decemail; 

非常奇怪的行为发生在一个“+”字符被删除,因此解密失败。

我试图删除UrlDecode,但这并没有解决问题。

什么解决的问题是这样做的:

 string email   = Request.QueryString["eId"].ToString(); 
     string decemail   = aes.Decrypt(email); 
     return decemail; 

摆脱UrlDecode的,并调用一个ToString()的查询字符串。

有谁知道为什么会发生这种情况? Request.QueryString默认调用urlDecode吗?我不认为它确实如此。

另外,为什么会做在这个实例中的ToString()的工作?

没错正确的。实际的Request.QueryString返回已解码的URL字符串。

来源:

http://www.codeproject.com/KB/custom-controls/antiauto.aspx?msg=1475521

http://www.kamath.com/codelibrary/cl006_url.asp

+0

啊啊啊,所以我是一个解码串进行解码。这毁了约90分钟的时间我笑 – 2009-11-18 22:59:39

+0

哈哈。那么现在你知道=) – mauris 2009-11-18 23:11:22