Hammy
Active member
Hi, I am working through an ASP.NET book, and I have a question about a piece of code.....
On a login page, if the username/password match, we set a cookie "FirstName" then redirect to another page. On the redirected page, we have a page_load event as follows....
sub Page_Load(obj as object, e as eventargs)
If (Request.Cookies("FirstName") is Nothing) Then
lblWelcomeMessage.Text = "Welcome <b>" & _
Request.Cookies("FirstName").Value & "!</b>"
End If
End Sub
Okay, I follow all of it, except for the "IS Nothing" can someone please tell me what "IS Nothing" is checking, and why we are using it in this context?
To me, it SOUNDS like it is checking that the cookie is blank, but obviously this not the case. Sooooooooo what does "Is Nothing" check, so I can know for future reference?
Thanks,
Hammy
On a login page, if the username/password match, we set a cookie "FirstName" then redirect to another page. On the redirected page, we have a page_load event as follows....
sub Page_Load(obj as object, e as eventargs)
If (Request.Cookies("FirstName") is Nothing) Then
lblWelcomeMessage.Text = "Welcome <b>" & _
Request.Cookies("FirstName").Value & "!</b>"
End If
End Sub
Okay, I follow all of it, except for the "IS Nothing" can someone please tell me what "IS Nothing" is checking, and why we are using it in this context?
To me, it SOUNDS like it is checking that the cookie is blank, but obviously this not the case. Sooooooooo what does "Is Nothing" check, so I can know for future reference?
Thanks,
Hammy