Solved

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

Posted on 2003-10-27
2
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

740 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