getting query info in a url

Discussion in 'ASP .Net' started by Jeff, Feb 27, 2007.

  1. Jeff

    Jeff Guest

    ASP.NET 2.0

    I'm wondering how I can get a specific parameter in the query string in a
    url. I have this url in my website:
    Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and its
    value.

    I've seached the documentation I came across Uri.Query which returns the
    entire query list in one single string (that is how I understand it). What
    I'm looking for is method/property which returns the parameters as a
    collection (name/value collection)

    Any suggestions?
     
    Jeff, Feb 27, 2007
    #1
    1. Advertising

  2. Jeff

    Jeff Guest

    Strange but just a few seconds after posting this question I came across
    what I was looking for:
    HttpRequest.QueryString


    "Jeff" <> wrote in message
    news:u%...
    > ASP.NET 2.0
    >
    > I'm wondering how I can get a specific parameter in the query string in a
    > url. I have this url in my website:
    > Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and
    > its value.
    >
    > I've seached the documentation I came across Uri.Query which returns the
    > entire query list in one single string (that is how I understand it). What
    > I'm looking for is method/property which returns the parameters as a
    > collection (name/value collection)
    >
    > Any suggestions?
    >
     
    Jeff, Feb 27, 2007
    #2
    1. Advertising

  3. Jeff

    Patrice Guest

    See Request.QueryString...

    "Jeff" <> a écrit dans le message de news:
    u%...
    > ASP.NET 2.0
    >
    > I'm wondering how I can get a specific parameter in the query string in a
    > url. I have this url in my website:
    > Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and
    > its value.
    >
    > I've seached the documentation I came across Uri.Query which returns the
    > entire query list in one single string (that is how I understand it). What
    > I'm looking for is method/property which returns the parameters as a
    > collection (name/value collection)
    >
    > Any suggestions?
    >
     
    Patrice, Feb 27, 2007
    #3
  4. > I'm wondering how I can get a specific parameter in the query string in a
    > url. I have this url in my website:
    > Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and
    > its value.


    Multiple ways:

    1. Request.QueryString["mode"]
    2. Request["mode"]

    However, note that while doing Request["mode"], we are looking at various
    places at one go:
    1. QueryString
    2. Form-Data
    3. Cookies
    4. Headers


    --
    Happy Hacking,
    Gaurav Vaish | www.mastergaurav.com
    www.edujini-labs.com
    http://eduzine.edujini-labs.com
    -----------------------------------------
     
    MasterGaurav \(www.edujini-labs.com\), Feb 27, 2007
    #4
  5. Just to help you bit more. Request is an namevaluecollection object in
    asp.net and represents a set of objects you can query. As a collection it
    can be iterated

    The QueryString you have found on your own but there are other properties of
    the request object that are equally useful, such as the Form,
    ServerVariables, and Cookie collections.

    Its worth reading a little about page execution to learn where various
    elements become exposed.
    http://msdn2.microsoft.com/en-us/library/aa479007.aspx

    --
    --
    Regards

    John Timney (MVP)
    http://www.johntimney.com
    http://www.johntimney.com/blog


    "Jeff" <> wrote in message
    news:...
    > Strange but just a few seconds after posting this question I came across
    > what I was looking for:
    > HttpRequest.QueryString
    >
    >
    > "Jeff" <> wrote in message
    > news:u%...
    >> ASP.NET 2.0
    >>
    >> I'm wondering how I can get a specific parameter in the query string in a
    >> url. I have this url in my website:
    >> Default.aspx?mode=1 So I'm wondering how I can the "mode" parameter and
    >> its value.
    >>
    >> I've seached the documentation I came across Uri.Query which returns the
    >> entire query list in one single string (that is how I understand it).
    >> What I'm looking for is method/property which returns the parameters as a
    >> collection (name/value collection)
    >>
    >> Any suggestions?
    >>

    >
    >
     
    John Timney \(MVP\), Feb 27, 2007
    #5
    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. Mavis
    Replies:
    1
    Views:
    606
    Andres Monroy-Hernandez
    Oct 3, 2004
  2. Jon paugh
    Replies:
    1
    Views:
    758
  3. Kartz

    Getting info of URL

    Kartz, May 3, 2007, in forum: Java
    Replies:
    0
    Views:
    323
    Kartz
    May 3, 2007
  4. ~greg
    Replies:
    5
    Views:
    136
    ~greg
    Apr 27, 2005
  5. nick
    Replies:
    1
    Views:
    463
    David Mark
    Feb 13, 2011
Loading...

Share This Page