Problem with events on default.aspx page (ASP.net 3.5)

I am having problems with the asp.net web form that uses the homepage. The problem only occurs when the page is named default.aspx. With the name default.aspx, if there is any code in the Page_Load event, other events do not fire. This also includes all the code I commented on. I tested OnInit and button click events, the problem first appeared when I pressed buttons that didnโ€™t work.

The default code is .aspx

<%@ 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 arrow 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 work: - checked through 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 work: - checked through 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 works if the aspx, cs and designer files are renamed to something other than the default value.

As for the main page. This is just a layout; there is no function in the .cs file.

What I tried:

  • Restart Visual Studio
  • Rebooting
  • Removing dll, pdb files from bin
  • Voodoo
  • Hair extension
  • Pulling other hair

I hope someone can help!

+7
source share
2 answers

Maybe this event has been fired, and itโ€™s just a problem with the Visual Studio debugger that you donโ€™t get to the breakpoint. Try writing some file and see if this happens.

+1
source

Try changing the codebehind namespace and / or class and see if this problem resolves. If so, it is possible due to other events / elements of the default.aspx event.

0
source

All Articles