Solved

How can I check parameter or session collection for a key?

Posted on 2003-10-27
2
210 Views
Last Modified: 2010-04-16
How can I check if a parameter exists in the parameter collection or a key exists in
the Session collection?  

Currently I get an error when I do this and when there is no parameter
passed to the page: Request.Params["DBType"].

Samething I get when I do this with the Session object.

The error I get is this:
System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 97:             private void Page_Load(object sender, System.EventArgs e)
Line 98:             {
Line 99:                   if(Request.QueryString["DSNType"].ToString() != "")
Line 100:                  {
Line 101:                              Response.Write("yes");
 
Thanks,

Andrzej
0
Comment
Question by:andw928
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
smegghead earned 50 total points
ID: 9628210
put something like..

object MyObj=Request.QueryString["DSNType"];
if (MyObj!=null)
{
    Response.Write("yes");
}
0
 
LVL 10

Expert Comment

by:smegghead
ID: 9628861
blimey, what do I have to do for an 'a' ?? do you want a tip ?

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
detecting  the added row index in a datagridview 3 60
Performance  Html.BeginForm vs jQuery 3 49
COnsume rest client 6 36
Error on link 14 37
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now