Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

I don't know, that's why I am asking.....

 

If...

 

If Request.Cookies("FirstName") Is Nothing

 

evaluates to true, does that mean the FirstName cookie exists, or doesn't exist?

 

Hammy

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...