Jul 23, 2009 04:58 PM|pghcpa7|LINK
This was enormously helpful code to me. I searched forever to find something this straightforward. You saved me many hours.
I wanted to add something another reader might find useful. I needed to add URL encoding so that the encrypted string would be ready for transport over HTTP. To do this (in vb.net) I add a reference to System.Web and use the HTTPUtility.URLEncode class
to transform it into a string
strEncoded = HttpUtility.UrlEncode(strEncrypted)
So, the steps are:
1. Store a string of query parameters
2. Encrypt it using code above
3. Encode it with URLEncode
4. Send it through as query string (one string of apparently-random characters)
5. Receive it on the other side as one big query string
6. use HTTP.Utility.URLDecode to get it back to a regular string
6. Decrypt it using the code above
7. Write a routine to parse it out because you can't use Request.QueryString("AB") for this purpose. You have to come up with your own such as request_equerystring("AB"). Some code for this was written up in the following article on the subject that talks
about the process but I could not get their encrypt and decrypt to work out-of-the-box in vb.net.
In my application, the data I am passing can only be obtained using a windows.form because it uses local data that is not brower-accessible. There are plenty of examples of ASP to ASP querystring passing out there where you can use server.transfer. But,
this is the only simple-to-follow reference I could find to calling up a browser with encrypted query strings from vb.net (that worked on first try).
Encrypting the Information Passed From the Query String
If there's an easier way, I'd love to hear it, though this was pretty straight-forward and fast.
vb.net querystring encrypt