How to unpack an encrypted QueryString?

R

Rob

Hi all,

I've encrypted an entire querystring, thus the keys and values, at the
moment I do only have one key and one value in it, so I could write
something specific for that key, but I know as soon as I do I'll need
to use more and then I'll be back here again...

So...lets assume I have this:

?uid=1234&dept=23

two keys, two values...

It all gets encrypted and turned into a load of old gibberish...

When my code is fired (upon the link being clicked) I am able to
decrypt the entire querystring and turn it back into the above, but at
this point I'm going to have a "string", not a "querystring"
(nameValueCollection) object.

So, how can I now take:

uid=1234&dept=23

and populate something else - dont really care what, but a
nameValueCollection would seem to make the most sense..it needs to be
something I could then query by the key "uid" to get the result
"1234"..

Any help appreciated..

Regards

Rob
 
B

Bruce Barker

Something like:

NameValueCollection queryvalues = new NameValueCollection();
string[] args = unencryptedQuery.Split('&');
foreach (string arg in args)
{
string[] nv = arg.Split('=');
queryValues.Add(vn[0],nv[1]);
}


-- bruce (sqlwork.com)
 
P

Patrice

Another option could be to use the RewritePath method (basically doing "url
rewriting" see http://www.codeproject.com/aspnet/URLRewriter.asp).

On the other hand you could perhaps inaverdantly expose uncrypted data. My
personal preference would be to use GUIDs value if this is to protect IDs
(and you could also double check server side that this particular use
actually has access to that).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top