View Single Post
  #5 (permalink)  
Old March 22nd, 2006, 03:47 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

Sorry Imar, Still can't get it to go buddy.

Here is what I have...

I have an include file that displays a different menu depending on whether you are logged in (cookie created) or logged out (no cookie). The code looks similar to the below:

Code:
If request.Cookies("recuser")("islogin") = 1 Then
  menu1
Else
  menu2
End If
.. now this works fine in my asp3 pages but the same include is also referenced within my asp.net2 pages too but this code causes the following error:

System.NullReferenceException: Object reference not set to an instance of an object.

When I test to see if the cookie exists first using the following code, this work fine in asp.net2 pages but not in asp3:

Code:
If Request.Cookies("recuser") IsNot Nothing Then

  If request.Cookies("recuser")("islogin") = 1 Then
    menu1
  Else
    menu2
  End If

Ensd If

Your last example seems to work fine in asp3 but not in asp.net2.

I suppose what I am trying to find is a mutual piece of code that will work in both versions of ASP... is this possible?

Warm Regards

Rit
Reply With Quote