Re: Checking for state's existence

Per Bolmstedt <[email protected]> Mon, 21 Apr 2008 10:29:33 -0400
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <LISTSERV%[email protected]>
On Mon, 21 Apr 2008 07:18:18 -0700, Mark Aurit <[email protected]> wrote:

> > What exactly are you checking, and why?
>
> Key values; for example the id of the person logged in which
> used throughout the app for audit logging.

Well, this is what I was talking about. The most common real-world solution
to this is to restrict your web application to authenticated users (deny=?).
This means from a page in the restricted location you can always rely on the
"current user name" to be defined.

If you have session/state stuff which you don't want to be null, how about
initializing all that when a session starts? This means it will be handled
automatically. For example, set Session["NumberOfPagesViewed"]=0 when a
session is created, and you can then henceforth rely on the value being
non-null.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com