I am having problems with an asp.net webform that uses a master page. The problem only occurs when the page is named default.aspx. When named default.aspx if there is any code in the Page_Load event, other events do not fire. This also includes all code commented out I've tested OnInit and Button click events, the problem first manifested itself with button clicks not firing.
Default.aspx code
<%@ Page Title="" Language="C#" MasterPageFile="~/TWS/tws.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="SITMComAU.TWS.original" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyPlaceholder" runat="server">
</asp:Content>
OnInit Fires: - Checked Via Break Point
public partial class original : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
int a = 1;
int b = 2;
int c = a;
}
}
OnInit Does Not Fire: - Checked Via Break Point
public partial class original : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
/*
int y = 5;
int z = y - 1;
*/
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
int a = 1;
int b = 2;
int c = a;
}
}
OnInit Does Not Fire: - Checked Via Break Point
public partial class original : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int y = 5;
int z = y - 1;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
int a = 1;
int b = 2;
int c = a;
}
}
All of the above work if the aspx, cs and designer files are renamed to anything other than default.
As for the master page. It is layout only, there is no functionality in the .cs file.
What I have tried:
I hope some one can help!
May be the event is being fired and its just a problem with Visual Studio debugger that you are not hitting the break point. Try to write some file and see if that happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With