gpt4 book ai didi

asp.net - Request.Querystring 从加密文本中删除字符

转载 作者:行者123 更新时间:2023-12-02 10:36:09 25 4
gpt4 key购买 nike

在我的应用程序中,我获取用户的电子邮件地址,对其进行加密和 URLEncode,然后将其传递到查询字符串中。

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

着陆页执行 Request.Querystring["email"]、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

关于asp.net - Request.Querystring 从加密文本中删除字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1759713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com