View Single Post
  #1 (permalink)  
Old February 2nd, 2006, 06:07 PM
rit01 rit01 is offline
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Handling Cookies

Hi All

Probably a 'School boy' error but for some reason when I check to see if a cookie value exists I get the following error if the cookie doesn't:

Code:
System.NullReferenceException: Object reference not set to an
instance of an object
How would be best to handle this?

The code I was using is:

Code:
If Request.Cookies("Cookie1")("cookie12") = "" Then
      Response.Redirect("login.aspx?Stat=FAIL")
End If
What I am trying to do is create a simple form of authentication against a user database table which creates a cookie if their credentials match. If the cookie doesn't exist then they are redirected to login page.

Many thanks

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
Reply With Quote