get parameter in url

Discussion in 'ASP General' started by Jean-Paul Lauque, Dec 28, 2003.

  1. Hello,

    I'm beginner in ASP.

    I would like to get parameter of ASP script in URL

    example : /localhost/example.asp?parameter1

    How can i to get this parameter ?

    Thanks a lot

    JP
     
    Jean-Paul Lauque, Dec 28, 2003
    #1
    1. Advertising

  2. Jean-Paul Lauque

    Steven Burn Guest

    Example;

    Dim strPar
    strPar = Request.QueryString("parameter1")

    or

    sPath=sPath&"?"&Request.ServerVariables("QUERY_STRING")

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Jean-Paul Lauque <> wrote in message
    news:bsnjtg$f8i$...
    > Hello,
    >
    > I'm beginner in ASP.
    >
    > I would like to get parameter of ASP script in URL
    >
    > example : /localhost/example.asp?parameter1
    >
    > How can i to get this parameter ?
    >
    > Thanks a lot
    >
    > JP
    >
    >
     
    Steven Burn, Dec 28, 2003
    #2
    1. Advertising

  3. Jean-Paul Lauque

    Bullschmidt Guest

    Example URL with a querystring:
    http://www.mysite.com/mydir/mypg.asp?myvar1=hey&myvar2=ho

    Because a variable might contain some odd characters like spaces, it's
    usually a good idea to use Server.URLEncode when creating a querystring
    from a variable:
    <a href="http://www.mysite.com/mypage?id=<%=
    Server.URLEncode(objRS("MyIDFldFromDB")) %>">objRS("MyIDFldFromDB")</a>

    And in the page that is opened you can use Request.QueryString("id") to
    get the value of id.

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Bullschmidt, Dec 30, 2003
    #3
    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. Jon paugh
    Replies:
    1
    Views:
    780
  2. Replies:
    4
    Views:
    680
  3. Just D.
    Replies:
    0
    Views:
    461
    Just D.
    Aug 11, 2004
  4. David Thielen

    Get full url from relative url

    David Thielen, May 25, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    206
    David Thielen
    May 26, 2006
  5. Abdul Mohsin
    Replies:
    1
    Views:
    269
Loading...

Share This Page