Base64-Encoded URL in ASP

Discussion in 'ASP General' started by Michael, Feb 23, 2004.

  1. Michael

    Michael Guest

    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
    Michael, Feb 23, 2004
    #1
    1. Advertising

  2. Michael

    Chris Barber Guest

    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" <> wrote in message
    news:...
    "Michael" <> wrote in message
    news:...
    > 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%3DMjM3MzpiMTcxODYwOjc%3D%26NzQzMTpwcm9kQW
    dlbmN5SUQ6MTI%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=&NzQzMTpwcm9kQWdlbmN5S
    UQ6MTI==MjcxNjowMDUxMjIwODo4&MTA0MjE6cHJvZEFnZW5jeU5hbWU6MTQ==MzA1NTA6REFVR0
    hFUlRZICYgQ08gSU5TIEJST0tFUlMgSU5DOjMw'
    > = ''
    >
    >
    > Any ideas how I can parse out each Base64-encoded name to to get the
    > matching Base64-encoded value?
    >
    > Thanks,
    > Michael Levy
    Chris Barber, Feb 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. T

    decode base64 encoded login info

    Mr. T, Mar 5, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    Patrice
    Mar 5, 2007
  2. Phil C.
    Replies:
    2
    Views:
    420
    Phil C.
    Jul 19, 2005
  3. Mr. T

    decode base64 encoded login info

    Mr. T, Mar 5, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    161
    Mr. T
    Mar 5, 2007
  4. Ram  Prasad

    base64 encoded sha1() string in openssl

    Ram Prasad, Dec 22, 2011, in forum: C Programming
    Replies:
    2
    Views:
    655
    tom st denis
    Dec 22, 2011
  5. Randy Lawrence
    Replies:
    0
    Views:
    271
    Randy Lawrence
    Jul 4, 2004
Loading...

Share This Page