Re: Checking for state's existence

Mark Aurit <[email protected]> Mon, 21 Apr 2008 07:13:09 -0700
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
Session works, any mechanism that uses some type of non-persistent storage.
I realize I could check of the value being null behind every attempt to
do anything to do anything with a value
in session, but that would bulk up my code.  Im just wondering if there
isnt another method, along the lines of those mentioned below, where I
can do it once and forget about it.  Perhaps that's unrealistic, or
perhaps every time I attempt to access such a value it should be through
a wrapper that first does the state check.
I wanted to see how those doing real world apps are approaching this
common problem.

Ryan Heath wrote:
> With state, you meant Session, no?
>
> With Session[key] != null you can check *everywhere* whether your
> state is still available.
> Where the *best place* is, depends on your architecture...
>
> HTH
> // Ryan
>
> On Mon, Apr 21, 2008 at 3:34 PM, Mark Aurit <[email protected]> wrote:
>
>> Where is the best place to test in asp.net apps that values placed in
>> state still exist (the person walking away from their browser after
>> logging in thing)? Putting the check in the masterpage seemed ideal, but
>> the page events fire first, so that isn't a lot of help. Should I put
>> the validation into a base page inherited by each page? Or each page's
>> Page_Load event? There is a lot of expertise here, I would like to hear
>> the best practices.
>>
>> Thanks, Mark
>>
>> ===================================
>> This list is hosted by DevelopMentor(R)  http://www.develop.com
>>
>> View archives and manage your subscription(s) at http://discuss.develop.com
>>
>>
>
> ===================================
> This list is hosted by DevelopMentorĀ®  http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>
>

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

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