How to make the aspx pages in your project to have common behavior or override the existing behavior of the all aspx pages?
1. Create a base class which inherits System.Web.UI.Page.
2. Write the logic to be implemented in the onload method or any other method where the behavior is expected to change.
3. Include the code to call the base method of the Page class.
4. Make all the aspx.cs classes to inherit the base class.
Basically this is useful when you want to check if a session is alive in the application or redirect the user to the login screen or to check the page permissions based on the role of the user.
public class BaseClass : System.Web.UI.Page
protected override void OnLoad(EventArgs e)