Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if session variable exists?

Status
Not open for further replies.

daughtd

Programmer
Sep 6, 2006
15
US
I need to check for the existance of a session variable using an if statement. How can this be done?

Ex:
If (SessionVar Exists){

}else{}
 
This has to do with ASP.NET - forum855

To answer you, try :

if (Session("name") == null)
{
// not exist
}
else
{
// exist
}

But, when a session ends, the vars are lost I think.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top