Hi,
I want all the logged in users to access my site and those not logged in to be directed to login page.
What all should i do in global.asax and web.config file?
You will need to create a Session variable
Session["UserId"] and check if this variable is null in all pages if yes redirect to login page
After successful login set the UserId of the user in session variable
Ok Sir,
But in web.config file can i do something
Web.Config you can do only for ASP.Net Membership logins. For others you cannot.
What you can do create a Base Class and inherit it in your all pages that require login
In that base class you can do your session checking
http://www.dreamincode.net/forums/topic/45300-base-page-for-detecting-session-timeout-in-aspnetc%23/
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.