Check user authentication at page load

Posted by Shrewd Demon on Stack Overflow See other posts from Stack Overflow or by Shrewd Demon
Published on 2010-05-18T10:14:02Z Indexed on 2010/05/18 10:20 UTC
Read the original article Hit count: 200

Filed under:
|
|

ok i have another question ! (god! i have so many questions)

i have an application and a user must log-in before he/she can access pages. now once the user logs in i keep the user details in a session variable (say Session["CurrentUser"]).

now if a user tries to jump to a page directly i will check if the Session["CurrentUser"] has a value or not...if not then the user will be directed to the login page...

my problem is that i have done this or rather say written this "Checking Code" on almost all the pages.

what i want is this code to stay on a particular location and i will just access that method all the time on all the pages...now where should i write this method ??

thank you.

© Stack Overflow or respective owner

Related posts about authentication

Related posts about c#