How to unpack an encrypted QueryString?

  • Thread starter Thread starter Rob
  • Start date Start date
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
 
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)
 
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).
 
Back
Top