Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Wierd cookie error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bobby Edward - 12 Mar 2008 03:41 GMT
Here's my code...

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) 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.Visible = True
           Else
               Me.panAdmin.Visible = 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.NullReferenceException: 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:

[NullReferenceException: Object reference not set to an instance of an
object.]
  BeachFuneralMain.Page_Load(Object sender, EventArgs e) in
F:\work-related\websites\BeachFuneral\BeachFuneralMain.master.vb:11
  System.Web.UI.Control.OnLoad(EventArgs e) +99
  System.Web.UI.Control.LoadRecursive() +47
  System.Web.UI.Control.LoadRecursive() +131
  System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433
Bobby Edward - 12 Mar 2008 03:48 GMT
I believe the problem is when a cookie does NOT exist.  The line isn't
checking it correctly????  Ideas?  Thanks!

> Here's my code...
>
[quoted text clipped - 41 lines]
> Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
> ASP.NET Version:2.0.50727.1433

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.