本文介绍了如何在重定向到asp.net中的新页面时加密数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在asp.net中从一页重定向到另一页,但是那时数据在地址栏中可见.
我想加密该数据.下面我提到我的代码.请检查并提供解决方案.
提前谢谢.

I want to redirect from one page to another page in asp.net but at that time data are visible at the address bar.
I want to encrypt that data. Below i am mentioning my code. Please check and give me a solution.
Thanks in advance.

string usr = "XXXX";
string ps = "XXXX";
string sid = "XXXX";
string mobileNos = "123456789";
string det = txtbox2.Text;
Response.Redirect("http://xxx.xxx.com/WebServiceSMS.aspx?User=" + usr + "&passwd=" + ps + "&mobilenumber=" + mobileNos + "&message=" + det + "&sid =" + sid + "&mtype=N");



调试之后,我在地址栏上找到了以下代码:

http://xxx.xxx.com/WebServiceSMS.aspx?User=XXXX&passwd=XXXX&mobilenumber=123456789&message=XXXX&sid%20=XXXX&mtype=N



After debugging this i have found this following code on my address bar:

http://xxx.xxx.com/WebServiceSMS.aspx?User=XXXX&passwd=XXXX&mobilenumber=123456789&message=XXXX&sid%20=XXXX&mtype=N

推荐答案


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");


这篇关于如何在重定向到asp.net中的新页面时加密数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 21:37