I have a webforms application. Almost all pages in my website are protected by login. Currently I am checking session exists or not in Page_Load event of all forms. Is there a way that I can do it in just one place which applies to all pages.
Share
Create a class that inherits from Web.UI.Page. In that class, create an event for Page_Load and put your code that checks for the session. Then on all of the pages you want to be protected by login, have them inherit the class you create.