views:

261

answers:

2

In one of my ASP.Net websites, I have to provide a link to the user in which all query string parameters should be encrypted.

What I am thinking is to use the command "aspnet_regiis" (as used to encrypt web.config data), pass output as a query string inside published url.

When the user clicks that link, I first decrypt the string and then fetch the original data for the query string.

Am I right in doing this? Is there any good technique to encrypt and decrypt query strings?

A: 

You don't need to call an external application. Use the cryptography API inside the framework to encrypt/decrypt data.

http://msdn.microsoft.com/en-us/library/system.security.cryptography(VS.71).aspx

onof
This is not a solution, a general link to a class. You need a lot to do to make it work you know.
Aristos
The question was if the technique is good. For me it's good, but instead of using an external program, use that classes to Encrypt and Decrypt. There is not much to do to make cryptography api encrypt and decrypt strings. I very often use that.The useful link posted by Krunal Mevada is a httpmodule using that classes, too.
onof
+8  A: 

I think you should try this out for querystring parameter encryption:

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

Krunal
I've used this solution in the past and it works well.
JohnC
@JohnC - me too.
Krunal
Thnaks,But i have one doubt; that anyone can decrypt origional text if having QuerystringmoduleConfig file ? As file is available free and anyone can pass encrypted string inside Decrypt method?
Hemant Kothiyal
@Hemant - You should change the encryption key for your project using `ENCRYPTION_KEY = "key";` inside the querystring module.
Krunal
OK,Ideally, what should i write in place of "key" any alphanumeric string or Is there any way to get system specific unique key. I think there is some thing inside machine.config. I am not exactly remember !!
Hemant Kothiyal
@hemant - you can use any alphanumeric string and test it out. It is worked fine for me in past projects.
Krunal