R
rn5a
A ASP.NET page checks for the existence of a cookie in the Page_Load
sub:
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim strUserName As String
Dim ckUserName As HttpCookie
Dim faTicket As FormsAuthenticationTicket
If (Request.Cookies("DomainCookie") IsNot Nothing) Then
ckUserName = Request.Cookies("DomainCookie")
faTicket = FormsAuthentication.Decrypt(ckUserName.Value)
strUserName = faTicket.Name
End If
End Sub
When I run the above code in my local intranet IIS5.1 server in WinXP
Pro (SP2), the If condition doesn't generate any error but when I
upload the above ASP.NET file to a remote hosting server, the If
condition generates the following error:
Value of type 'System.Web.HttpCookie' cannot be converted to
'Boolean'.
which points to the If condition in the above code.
Can someone please throw some light on why is this happening? Why does
the above code snippet generate the above error when I upload the
ASP.NET file to a remote server though it works perfectly fine when I
run the same code snippet in my local Intranet server?
sub:
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim strUserName As String
Dim ckUserName As HttpCookie
Dim faTicket As FormsAuthenticationTicket
If (Request.Cookies("DomainCookie") IsNot Nothing) Then
ckUserName = Request.Cookies("DomainCookie")
faTicket = FormsAuthentication.Decrypt(ckUserName.Value)
strUserName = faTicket.Name
End If
End Sub
When I run the above code in my local intranet IIS5.1 server in WinXP
Pro (SP2), the If condition doesn't generate any error but when I
upload the above ASP.NET file to a remote hosting server, the If
condition generates the following error:
Value of type 'System.Web.HttpCookie' cannot be converted to
'Boolean'.
which points to the If condition in the above code.
Can someone please throw some light on why is this happening? Why does
the above code snippet generate the above error when I upload the
ASP.NET file to a remote server though it works perfectly fine when I
run the same code snippet in my local Intranet server?