Wierd cookie error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Edward

    Wierd cookie error

    Here's my code...

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles Me.Load
    If Not Request.Cookies ("UserSettings" )("IsAdmin") Is Nothing Then
    ' THIS IS LINE 11
    If Request.Cookies ("UserSettings" )("IsAdmin") = "True" Then
    Me.panAdmin.Vis ible = True
    Else
    Me.panAdmin.Vis ible = False
    End If
    End If
    End Sub

    Works perfectly locally. But, when I upload it to the production server I
    get this error.... Any ideas????
    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.

    Exception Details: System.NullRefe renceException: Object reference not set
    to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of the
    exception can be identified using the exception stack trace below.

    Stack Trace:

    [NullReferenceEx ception: Object reference not set to an instance of an
    object.]
    BeachFuneralMai n.Page_Load(Obj ect sender, EventArgs e) in
    F:\work-related\website s\BeachFuneral\ BeachFuneralMai n.master.vb:11
    System.Web.UI.C ontrol.OnLoad(E ventArgs e) +99
    System.Web.UI.C ontrol.LoadRecu rsive() +47
    System.Web.UI.C ontrol.LoadRecu rsive() +131
    System.Web.UI.P age.ProcessRequ estMain(Boolean
    includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1436



    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.507 27.1433;
    ASP.NET Version:2.0.507 27.1433


  • Bobby Edward

    #2
    Re: Wierd cookie error

    I believe the problem is when a cookie does NOT exist. The line isn't
    checking it correctly???? Ideas? Thanks!

    "Bobby Edward" <test@test.comw rote in message
    news:ehuMZr%23g IHA.5780@TK2MSF TNGP06.phx.gbl. ..
    Here's my code...
    >
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles Me.Load
    If Not Request.Cookies ("UserSettings" )("IsAdmin") Is Nothing Then '
    THIS IS LINE 11
    If Request.Cookies ("UserSettings" )("IsAdmin") = "True" Then
    Me.panAdmin.Vis ible = True
    Else
    Me.panAdmin.Vis ible = False
    End If
    End If
    End Sub
    >
    Works perfectly locally. But, when I upload it to the production server I
    get this error.... Any ideas????
    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information
    about the error and where it originated in the code.
    >
    Exception Details: System.NullRefe renceException: Object reference not set
    to an instance of an object.
    >
    Source Error:
    >
    An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of the
    exception can be identified using the exception stack trace below.
    >
    Stack Trace:
    >
    [NullReferenceEx ception: Object reference not set to an instance of an
    object.]
    BeachFuneralMai n.Page_Load(Obj ect sender, EventArgs e) in
    F:\work-related\website s\BeachFuneral\ BeachFuneralMai n.master.vb:11
    System.Web.UI.C ontrol.OnLoad(E ventArgs e) +99
    System.Web.UI.C ontrol.LoadRecu rsive() +47
    System.Web.UI.C ontrol.LoadRecu rsive() +131
    System.Web.UI.P age.ProcessRequ estMain(Boolean
    includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1436
    >
    >
    >
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.507 27.1433;
    ASP.NET Version:2.0.507 27.1433
    >

    Comment

    Working...