Saturday, March 24, 2012

Object reference not set to an instance of an object

Hey Guys,

It seems that a few of my users are getting this error and i dont know why

Heres my code

-- The Sub --
Sub EmailAddButton(sender As Object, e As EventArgs)

If NOT ViewState("Member") = "0" Then

Dim cookPassword As String = Request.Cookies("password").Value <<<<< ERROR HERE
dim cookUsername as string = Request.Cookies("username").Value

-- The Button --
<asp:LinkButton id="EmailAddLink" Text="Email Me Updates" OnClick="EmailAddButton" runat="server" />

Does anyone have any ideas?It means that there isn't a Cookie called "password" (a HttpCookie Object hasn't been instantiated) and therefore you can't access the Value Property of the Object.

0 comments:

Post a Comment