page.aspx?option - how to detect "option"

Discussion in 'ASP .Net' started by Kevin Blount, Nov 28, 2006.

  1. Kevin Blount

    Kevin Blount Guest

    I've seen some sites that have URLs like this:

    blahblah.com/page.aspx?option

    i.e. there's no 'value' for the 'name' option. I'd like to find out how
    to detect if the name' is part of the URL if there's no 'value'.

    Can anyone tell me?

    I can work with "?option=value&option2=value" no problem.. but I've been
    trying all morning to get just "?option" to detect, without success.

    Cheers and TIA

    Kevin
     
    Kevin Blount, Nov 28, 2006
    #1
    1. Advertising

  2. Kevin Blount

    Mark Rae Guest

    "Kevin Blount" <> wrote in message
    news:...

    Request.QueryString on its own will return everything which follows the ?
     
    Mark Rae, Nov 28, 2006
    #2
    1. Advertising

  3. Kevin Blount

    Kevin Blount Guest

    Mark,

    Thanks for the reply, but I'm not sure how you're suggesting I use that
    info.

    Are you thinking of "string myURL = Request.QueryString;", or is there
    something else you're suggesting?

    Thanks

    Kevin

    Mark Rae wrote:
    > "Kevin Blount" <> wrote in message
    > news:...
    >
    > Request.QueryString on its own will return everything which follows the ?
    >
    >
     
    Kevin Blount, Nov 28, 2006
    #3
  4. Kevin Blount

    Mark Rae Guest

    "Kevin Blount" <> wrote in message
    news:...

    > Are you thinking of "string myURL = Request.QueryString;",


    Yes.

    > or is there something else you're suggesting?


    No.
     
    Mark Rae, Nov 28, 2006
    #4
  5. Kevin Blount

    Kevin Blount Guest

    ok

    Mark Rae wrote:
    > "Kevin Blount" <> wrote in message
    > news:...
    >
    >> Are you thinking of "string myURL = Request.QueryString;",

    >
    > Yes.
    >
    >> or is there something else you're suggesting?

    >
    > No.
    >
    >
     
    Kevin Blount, Nov 28, 2006
    #5
  6. Kevin,
    in ASP.NET, Request.QueryString is a NameValueCollection object.
    So, you can have a name whose value is null (or an empty string).
    Take a look at NameValueCollection in the documentation, that will give
    you a better scope on what you want to do.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "Kevin Blount" wrote:

    > ok
    >
    > Mark Rae wrote:
    > > "Kevin Blount" <> wrote in message
    > > news:...
    > >
    > >> Are you thinking of "string myURL = Request.QueryString;",

    > >
    > > Yes.
    > >
    > >> or is there something else you're suggesting?

    > >
    > > No.
    > >
    > >

    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Nov 28, 2006
    #6
  7. In this case, NameValueCollection (nvc) will not help him as he wants to
    detect "?option". If it was detecting "?option=", then nvc would have helped.
    In case of "?option" the array of nvc will show a length of 1, but the key
    name would be null. While there may better solutions, the one proposed by
    Mark Rae is the easiest to implement.

    - eeraj
    ====
    http://www.interviewboard.com


    "Peter Bromberg [C# MVP]" wrote:

    > Kevin,
    > in ASP.NET, Request.QueryString is a NameValueCollection object.
    > So, you can have a name whose value is null (or an empty string).
    > Take a look at NameValueCollection in the documentation, that will give
    > you a better scope on what you want to do.
    > Peter
     
    =?Utf-8?B?RWVyYWo=?=, Nov 28, 2006
    #7
    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. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,044
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  2. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,223
    Matt Morris
    Jan 23, 2004
  3. John M
    Replies:
    1
    Views:
    1,289
    Kumar Reddi
    May 29, 2005
  4. Cas
    Replies:
    5
    Views:
    817
    Kevin Jones
    Aug 28, 2006
  5. Frank Jiang

    detect browser flash plugin and pass result to ASPX page

    Frank Jiang, Sep 5, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    433
    Frank Jiang
    Sep 5, 2003
Loading...

Share This Page