Request.Querystring?

Discussion in 'ASP General' started by John ., Mar 3, 2005.

  1. John .

    John . Guest

    I have a URL in which I am trying to grab its querystring. Its format
    looks like this:

    http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    ge.asp?topic=45&subject=180

    My code snippet below:

    sURL = Request.QueryString("theUrl")
    Response.Write sURL

    Gives me this:
    http://www.otherdomain.com/otherpage.asp?topic=45

    How can I get the whole link (including the &subject=180)?





    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    John ., Mar 3, 2005
    #1
    1. Advertising

  2. John .

    Hal Rosser Guest

    "John ." <> wrote in message
    news:...
    > I have a URL in which I am trying to grab its querystring. Its format
    > looks like this:
    >
    > http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    > ge.asp?topic=45&subject=180
    >
    > My code snippet below:
    >
    > sURL = Request.QueryString("theUrl")
    > Response.Write sURL
    >
    > Gives me this:
    > http://www.otherdomain.com/otherpage.asp?topic=45
    >
    > How can I get the whole link (including the &subject=180)?


    If you want it all, just access the whole querystring:
    Response.write Request.QueryString
    I like your example *** a querystring with a URL with a querystring ;-)
    that's almost recursive
     
    Hal Rosser, Mar 3, 2005
    #2
    1. Advertising

  3. John .

    Jeff Cochran Guest

    On Thu, 03 Mar 2005 13:56:23 -0800, John . <> wrote:

    >I have a URL in which I am trying to grab its querystring. Its format
    >looks like this:
    >
    >http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    >ge.asp?topic=45&subject=180
    >
    >My code snippet below:
    >
    > sURL = Request.QueryString("theUrl")
    > Response.Write sURL
    >
    >Gives me this:
    >http://www.otherdomain.com/otherpage.asp?topic=45
    >
    >How can I get the whole link (including the &subject=180)?


    You can't easily. The rest isn't part of "theURL" since it's part of
    "subject" in your querystring. The ampersand (&) is a demarcation for
    the querystring argument.

    Jeff
     
    Jeff Cochran, Mar 3, 2005
    #3
  4. John .

    Evertjan. Guest

    John . wrote on 03 mrt 2005 in microsoft.public.inetserver.asp.general:

    > http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    > ge.asp?topic=45&subject=180
    >
    > My code snippet below:
    >
    > sURL = Request.QueryString("theUrl")
    > Response.Write sURL
    >


    http://www.domain.com/page.asp?
    theURL=http://www.otherdomain.com/otherpage.asp?topic=45^subject=180

    ----

    URL = replace(request.QueryString("theUrl"),"^","&")
    Response.Write sURL



    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Mar 3, 2005
    #4
  5. John .

    PiGei Guest

    "John ." <> wrote in message
    news:
    > I have a URL in which I am trying to grab its querystring. Its
    > format looks like this:
    >
    >

    http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    > ge.asp?topic=45&subject=180
    >
    > My code snippet below:
    >
    > sURL = Request.QueryString("theUrl")
    > Response.Write sURL
    >
    > Gives me this:
    > http://www.otherdomain.com/otherpage.asp?topic=45
    >
    > How can I get the whole link (including the &subject=180)?


    http://www.domain.com/page.asp?theURL=<%=Server.URLEncode("http://www.otherdomain.com/otherpage.asp?topic=45&subject=180")%>

    bye
    PGei
     
    PiGei, Mar 7, 2005
    #5
  6. John .

    Mark Schupp Guest

    The original link must URL encode the "&" before "subject". As far a the
    server can tell the link has 2 parameters, "theURL" and "subject".

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "PiGei" <> wrote in message
    news:...
    > "John ." <> wrote in message
    > news:
    > > I have a URL in which I am trying to grab its querystring. Its
    > > format looks like this:
    > >
    > >

    > http://www.domain.com/page.asp?theURL=http://www.otherdomain.com/otherpa
    > > ge.asp?topic=45&subject=180
    > >
    > > My code snippet below:
    > >
    > > sURL = Request.QueryString("theUrl")
    > > Response.Write sURL
    > >
    > > Gives me this:
    > > http://www.otherdomain.com/otherpage.asp?topic=45
    > >
    > > How can I get the whole link (including the &subject=180)?

    >
    >

    http://www.domain.com/page.asp?theURL=<%=Server.URLEncode("http://www.otherdomain.com/otherpage.asp?topic=45&subject=180")%>
    >
    > bye
    > PGei
    >
    >
     
    Mark Schupp, Mar 7, 2005
    #6
    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. Daniel Bass
    Replies:
    2
    Views:
    3,736
    dave wanta
    Jul 4, 2003
  2. George
    Replies:
    5
    Views:
    6,647
    George
    Apr 2, 2004
  3. michaaal
    Replies:
    6
    Views:
    423
    Michael D. Kersey
    Jul 15, 2003
  4. John Davis
    Replies:
    2
    Views:
    407
    Dave Anderson
    Aug 18, 2003
  5. Ivan
    Replies:
    5
    Views:
    164
Loading...

Share This Page