473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

testing for querystring

Hi all,

I would like to have a page that checks for an optional
parameter being passed.

I use the request.querystring("myvar") when the parameter is
being passed, but when the parameter is not passed I get an object reference
exception. How can I check for the existence of the variable being
passed?

Thanks,

Carlos.
Feb 8 '07 #1
2 3594
c#
if (Request.QueryString["myvar"] != null)
// myvar exists
else
// it doesn't

vb.bet (I think)
if Request.QueryString("myvar") is nothing then
// exists
else
// doesn't
end if

"Carlos" <ch******@yahoo.comwrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl...
Hi all,

I would like to have a page that checks for an optional
parameter being passed.

I use the request.querystring("myvar") when the parameter is
being passed, but when the parameter is not passed I get an object
reference exception. How can I check for the existence of the variable
being
passed?

Thanks,

Carlos.

Feb 8 '07 #2
Deliberate mistake in the vb.net section, reverse the "exists" and "doesn't"
:)

"Aidy" <ai**@noemail.xxxa.comwrote in message
news:y7******************************@bt.com...
c#
if (Request.QueryString["myvar"] != null)
// myvar exists
else
// it doesn't

vb.bet (I think)
if Request.QueryString("myvar") is nothing then
// exists
else
// doesn't
end if

"Carlos" <ch******@yahoo.comwrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl...
>Hi all,

I would like to have a page that checks for an optional
parameter being passed.

I use the request.querystring("myvar") when the parameter is
being passed, but when the parameter is not passed I get an object
reference exception. How can I check for the existence of the variable
being
passed?

Thanks,

Carlos.


Feb 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%=...
10
by: Carl Gilbert | last post by:
Hi I am working on a site to provide displaying and navigation of images from several groups and have the following code that changes to displayed gif based on the query string passed in: ...
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
0
by: Sri | last post by:
Hi I am trying to figure out how to test whether my browser cookies are enabled. I used the code from the following page...
4
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
1
by: beebee | last post by:
Hi all. I am having a bit of difficulty: Here is what is happening: I have an application that spits out a thankyou.aspx page and i would like to pass it the querystring values it had collected...
3
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.