Results 1 to 7 of 7

Thread: [RESOLVED] Check if Cookie has been set?

Threaded View

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Resolved [RESOLVED] Check if Cookie has been set?

    Hi,

    I'm getting an Object reference error and I'm sure the problem is because the LoginTarget cookie hasn't been set, this is possible if a user came to the login page first, without attempting to visit a restricted page first.

    I'm using IsNothing to check to see if it's been created but it doesn't seem to be working does anyone know of a better way of handling this?

    VB Code:
    1. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    2.  
    3. Source Error:
    4.  
    5. Line 78:             Response.Cookies("User_ID").Value = User_ID
    6. Line 79:
    7. [HL="#FFFF00"]Line 80:             Response.Redirect(Convert.ToString(IIf(IsNothing(Request.Cookies("LoginTarget")), _
    8.                                   RedirectPage.ToString, Request.Cookies("LoginTarget").Value)), False)[/HL]
    9. Line 81:             'Response.Redirect(RedirectPage.ToString, False)
    10. Line 82:         Else
    Last edited by aconybeare; Oct 2nd, 2005 at 04:16 PM. Reason: retitle and improve detail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width