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

  • Thread starter Thread starter Kevin Blount
  • Start date Start date
K

Kevin Blount

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
 
Request.QueryString on its own will return everything which follows the ?
 
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
 
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
 
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top