Event of asp.net master page not firing

asp.neteventsmaster-pages

I put a break point at the protected void Page_Load(object sender, EventArgs e) method of my master page, but when i start the site it does not hit that break point.

Why is the event not firing? I would like to use this event along with others such as the Init event in order to check to see if the session has expired everytime a page loads…

Thanks.

Best Answer

You can check that AutoEventWireup is set to true in the Master declaration.

<%@ Master Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="MasterPages_Main" %>

If it is set to false you have to manually connect the events.

Related Topic