Thursday, March 29, 2012

Session variable

Hello,
How to declare a variable of session without value (empty) ?
Because If I use a page with a Null Session I have the error :
"Object reference not set to an instance of an object."
on this line :
Line 16: Dim SessionUser As String = Session("USER").ToString

Thank you for your help.
PAB.You can use String.Empty for string values
Hello,
Thanks, I try that.
PAB.
C#

if ( Session["User"] == null)
{

// not exists

}

VB.Net

IF SESSION["USER"] is Nothing THEN

// Not Exists.

END IF

0 comments:

Post a Comment