Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Base64-Encoded URL in ASP (http://www.velocityreviews.com/forums/t793510-base64-encoded-url-in-asp.html)

Michael 02-23-2004 05:55 PM

Base64-Encoded URL in ASP
 
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%3DMjM3MzpiMTcxO DYwOjc%3D%26NzQzMTpwcm9kQWdlbmN5SUQ6MTI%3D%3DMjcxN jowMDUxMjIwODo4%26MTA0MjE6cHJvZEFnZW5jeU5hbWU6MTQ% 3D%3DMzA1NTA6REFVR0hFUlRZICYgQ08gSU5TIEJST0tFUlMgS U5DOjMw
---------------------------------------------------------------

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("MTAwMjg6cHJvZFByb2R1Y2VySUQ6M TQ%3D") = ''
Request.QueryString("MTAwMjg6cHJvZFByb2R1Y2VySUQ6M TQ=") = ''


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==MjM3MzpiMTcxODYw Ojc=&NzQzMTpwcm9kQWdlbmN5SUQ6MTI==MjcxNjowMDUxMjIw ODo4&MTA0MjE6cHJvZEFnZW5jeU5hbWU6MTQ==MzA1NTA6REFV R0hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5DOjMw'
= ''


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

Thanks,
Michael Levy

Chris Barber 02-24-2004 12:43 AM

Re: Base64-Encoded URL in ASP
 
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.

"Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in message
news:103kjb27bt9at72@corp.supernews.com...
"Michael" <Michael@MichaelLevy.net> wrote in message
news:4400d199.0402230955.60d14fd7@posting.google.c om...
> 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

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

MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ%3D%3DMjM3MzpiMTcxO DYwOjc%3D%26NzQzMTpwcm9kQW
dlbmN5SUQ6MTI%3D%3DMjcxNjowMDUxMjIwODo4%26MTA0MjE6 cHJvZEFnZW5jeU5hbWU6MTQ%3D
%3DMzA1NTA6REFVR0hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5 DOjMw
> ---------------------------------------------------------------
>
> 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("MTAwMjg6cHJvZFByb2R1Y2VySUQ6M TQ%3D") = ''
> Request.QueryString("MTAwMjg6cHJvZFByb2R1Y2VySUQ6M TQ=") = ''
>
>
> 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==MjM3MzpiMTcxODYw Ojc=&NzQzMTpwcm9kQWdlbmN5S
UQ6MTI==MjcxNjowMDUxMjIwODo4&MTA0MjE6cHJvZEFnZW5je U5hbWU6MTQ==MzA1NTA6REFVR0
hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5DOjMw'
> = ''
>
>
> Any ideas how I can parse out each Base64-encoded name to to get the
> matching Base64-encoded value?
>
> Thanks,
> Michael Levy






All times are GMT. The time now is 12:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.