Can't detect whether Session variable exists
my code is:
if session("something") then end if
any way to validate this?
greetings
Assuming this is VB.NET:
If Not (session("something") Is Nothing) Then
' use session("something")
End If
VB.NET:
If session("whatever") is nothing then
do something
Else
do something else
End if
Have this code in the Page_Load()
if(Session["SessionName"] == null)
{
//Session Does not Exists
}
else
{
//Session Exists
}
or Refer:
What is the best way to determine a session variable is null or empty in C#?