且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在重定向到asp.net中的新页面时加密数据

更新时间:2023-11-23 10:22:22

您不应将敏感信息作为查询字符串传递.我可以看到您正在传递用户ID,密码,手机号码等.
这是一个糟糕的设计

您可以使用以下选项之一:

1.使用回发
2.在会话中存储数据
3.在viewstate中存储数据
4.利用Cookie

如果要加密和解密,则可以从以下URL使用HTTPModule:

http://madskristensen.net/post/HttpModule-for-query-string-encryption.aspx
You should not pass the sensitive information as a querystring. I can see that you are passing user id, password, mobile number etc.
This is a bad design

You can use one of the options:

1. use a Postback
2. Storing data in sessions
3. storing data in viewstate
4. making use of cookies

If you want encrypt and decrypt, you can use HTTPModule from the following URL:

http://madskristensen.net/post/HttpModule-for-query-string-encryption.aspx


byte[] data = new byte[DATA_SIZE];
byte[] result;
SHA512 shaM = new SHA512Managed();
result = shaM.ComputeHash("User");



这将给SHA512计算哈希值.

看看下面要使用的其他功能.

http://msdn.microsoft.com/en-us/library/9eat8fht%28v = VS.71%29.aspx [ ^ ]


或者尝试使用会话值,以便在重定向时不要将值发布到您的url中.这很简单
只需使用lik



this wil giv ur SHA512 computed hash value.

take a look at the following to use other function.

http://msdn.microsoft.com/en-us/library/9eat8fht%28v=VS.71%29.aspx[^]


Or try using the session values, so that when redirecting you dont hav to post the values into ur url. Which is simple
simply use it lik

<pre>Session["User"]="xxxx";
Session["ps"]="xxxx";
...
Response.Redirect("http://xxx.xxx.com/WebServiceSMS.aspx");