Checking if URL parameter exists

  • Thread starter Thread starter Andrew Banks
  • Start date Start date
A

Andrew Banks

How can I check if a URL parameter exists before trying to do something

If(Request.QueryString("Whatever") EXISTS??)
{
DoSomething();
}
 
How can I check if a URL parameter exists before trying to do
something

If(Request.QueryString("Whatever") EXISTS??)
{
DoSomething();
}

Andrew,

Check to see if it's null:

if (Request.QueryString("Whatever") != null)
{
...
}

Hope this helps.

Chris.
 
if (Request.QueryString["Whatever"] != null)

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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