M
Michel Salim
Hello,
In my application I am trying to check if a HttpContext.Session key is
set, and if not, retrieve its value by making a function call.
The code excerpt as it stands:
Dim userEntry As LdapEntry =
HttpContext.Current.Session("userEntry")
If userEntry Is Nothing Then
Dim UserAuthentication As New UserAuthentication
userEntry =
UserAuthentication.GetDetails(Page.User.Identity.Name)
End If
(LdapEntry comes from Novell's LDAP library for .NET, and
UserAuthentication is a custom class)
The problem is that userEntry does not contain a null object
(Nothing), it is simply uninitialized, and I get a runtime error to
that effect.
Is there a way to deal with this properly, or should I just attempt to
use userEntry within a try/catch block?
Thanks in advance,
- Michel
In my application I am trying to check if a HttpContext.Session key is
set, and if not, retrieve its value by making a function call.
The code excerpt as it stands:
Dim userEntry As LdapEntry =
HttpContext.Current.Session("userEntry")
If userEntry Is Nothing Then
Dim UserAuthentication As New UserAuthentication
userEntry =
UserAuthentication.GetDetails(Page.User.Identity.Name)
End If
(LdapEntry comes from Novell's LDAP library for .NET, and
UserAuthentication is a custom class)
The problem is that userEntry does not contain a null object
(Nothing), it is simply uninitialized, and I get a runtime error to
that effect.
Is there a way to deal with this properly, or should I just attempt to
use userEntry within a try/catch block?
Thanks in advance,
- Michel