Solved

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

Posted on 2003-10-27
2
223 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Greetings C# program 17 124
Adding  DYMO Labelprinter to c# client application 4 81
C# Formatting DateTime String Value 5 26
How to repeat the data 4 13
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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