Best way to check a session var on each page?

J

Jon

I am setting a session var upon login that holds some data about the user.
I need to check on every page to make sure the data is populated so if a
user bypasses the login page they are redirected to login first! I know on
each page load I can do a check of the session var and redirect if it's gone
or the wrong value, but I'd like a way to do it from one location. What's
the recommended method for this type of thing?

Thanks
 
D

Dimitri Glazkov

Jon,

Are you sure you are not duplicating the functionality already provided by
Forms authentication? If not, then do it in Application_AuthenticateRequest
method of your Global.asax.cs file.

:DG<
 
J

Jon

That'll work...Just one question, how do I convert this event adding
statement to VB.Net?
 
J

Jon

That'll work. One question, what is the equivalent of the following in
VB.Net?

base.Load +=new EventHandler(CommonPage_Load);

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top