ASP.Net storing objects in session state
How do I check if an ASP.net session contains a particular variable or not? I want to do something like this.
I do not know the type of the data that is stored in Session("user"). I just want to know if anything has been assigned to it.
if Session("user") <> "" Then
'... do something here...
The above causes an error:
Overload resolution failed because no Public '<>' can be called with these arguments:
'Public Shared Operator <>(a As String, b As String) As Boolean':
Argument matching parameter 'a' cannot convert from 'SchedulerUser' to 'String'.
I hope someone can help!
If Session("user") IsNot Nothing Then
Even if the Session isn't yet created, it'll always throw a String.Empty
IF not Session("user") = String.Empty THEN
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)