Click here to Skip to main content
16,017,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

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


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
Posted
Updated 22-Sep-11 23:26pm
v3

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
 
Share this answer
 
Comments
sahabiswarup 23-Sep-11 8:15am    
I have never done this before. So can you please give some example.
I'll be very much grateful to you.
C#
byte[] data = new byte[DATA_SIZE];
byte[] result;
SHA512 shaM = new SHA512Managed();
result = shaM.ComputeHash("User");


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
C#
<pre>Session["User"]="xxxx";
Session["ps"]="xxxx";
...
Response.Redirect("http://xxx.xxx.com/WebServiceSMS.aspx");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900