Base64-Encoded URL in ASP

M

Michael

I am trying to integrate my ASP page with an external application that
sends me a QueryString that is URLEncoded and each Name and Value in
the QueryString is Base64 Encoded as well.

---------------------------------------------------------------
Sample QueryString:

MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ%3D%3DMjM3MzpiMTcxODYwOjc%3D%26NzQzMTpwcm9kQWdlbmN5SUQ6MTI%3D%3DMjcxNjowMDUxMjIwODo4%26MTA0MjE6cHJvZEFnZW5jeU5hbWU6MTQ%3D%3DMzA1NTA6REFVR0hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5DOjMw
---------------------------------------------------------------

I know what the named items in the QueryString are and accurately
Base64 encode them so that I see the text in the QueryString. But when
I try to get the matching value from the QueryString, I get an empty
string returned.

Request.QueryString("MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ%3D") = ''
Request.QueryString("MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ=") = ''


I tried looping through the name/value pairs in the QueryString but it
seems to think the entire QueryString is 1 named item with no value. I
put single quotes around each name and each value and got the
following:

'MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ==MjM3MzpiMTcxODYwOjc=&NzQzMTpwcm9kQWdlbmN5SUQ6MTI==MjcxNjowMDUxMjIwODo4&MTA0MjE6cHJvZEFnZW5jeU5hbWU6MTQ==MzA1NTA6REFVR0hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5DOjMw'
= ''


Any ideas how I can parse out each Base64-encoded name to to get the
matching Base64-encoded value?

Thanks,
Michael Levy
 
C

Chris Barber

Just URLUnencode it and then split for name value pairs and Base64 Unencode
the values - the code to achieve both is readily available on Google.

Chris.

Michael said:
I am trying to integrate my ASP page with an external application that
sends me a QueryString that is URLEncoded and each Name and Value in
the QueryString is Base64 Encoded as well.

I think the mistake that is being made is that only the name/values should
be URLEncoded, but in your case the entire string (including the "=") has
been encoded. There's no way to decode it. For example, if I had a
variable named foo, with a value of 1+1=2, that should be URLEncoded as:

foo=1%2B1%3D2

But instead, you have encoded the entire string:

foo%3D1%2B1%3D2

There is no way to know how to decode this so that the first %3D is the "="
between the name/value pair.

Peter Foti
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top