Asp.net Page_Init()被调用两次

Asp.net Page_Init()被调用两次,asp.net,Asp.net,我的页面的Page\u Init()方法在第一次显示之前被调用了两次。在这两种情况下,IsPostBack==false。我已设置了AutoEventWireup=“true”。以下是调用时的两个堆栈跟踪: 第一个电话: G2.dll!Ctron.UI.Common.BreakoutDialog.Page_Init(object sender, System.EventArgs e) Line 46 C# System.Web.dll!System.Web.Util.CalliEventHan

我的页面的
Page\u Init()
方法在第一次显示之前被调用了两次。在这两种情况下,IsPostBack==false。我已设置了
AutoEventWireup=“true”
。以下是调用时的两个堆栈跟踪:

第一个电话:

G2.dll!Ctron.UI.Common.BreakoutDialog.Page_Init(object sender, System.EventArgs e) Line 46  C#
System.Web.dll!System.Web.Util.CalliEventHandlerDelegateProxy.Callback(object sender, System.EventArgs e)   Unknown
System.Web.dll!System.Web.UI.Control.OnInit(System.EventArgs e) Unknown
System.Web.dll!System.Web.UI.Page.OnInit(System.EventArgs e)    Unknown
CXGlobal.dll!Ctron.UI.CtronDialog.OnInit(System.EventArgs e) Line 27    C#
System.Web.dll!System.Web.UI.Control.InitRecursive(System.Web.UI.Control namingContainer)   Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest()  Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext context)    Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context)    Unknown
App_Web_g2ej3jrk.dll!ASP.common_breakoutdialog_aspx.ProcessRequest(System.Web.HttpContext context)  C#
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  Unknown
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)  Unknown
System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error)    Unknown
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData)   Unknown
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr)   Unknown
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr)   Unknown
System.Web.dll!System.Web.Hosting.ISAPIRuntime.ProcessRequest(System.IntPtr ecb, int iWRType)   Unknown
System.Web.dll!System.Web.Hosting.ISAPIRuntime.System.Web.Hosting.IISAPIRuntime2.ProcessRequest(System.IntPtr ecb, int iWRType) Unknown
[AppDomain Transition]  
第二个电话:

G2.dll!Ctron.UI.Common.BreakoutDialog.Page_Init(object sender, System.EventArgs e) Line 46  C#
System.Web.dll!System.Web.Util.CalliEventHandlerDelegateProxy.Callback(object sender, System.EventArgs e)   Unknown
System.Web.dll!System.Web.UI.Control.OnInit(System.EventArgs e) Unknown
System.Web.dll!System.Web.UI.Page.OnInit(System.EventArgs e)    Unknown
CXGlobal.dll!Ctron.UI.CtronDialog.OnInit(System.EventArgs e) Line 27    C#
System.Web.dll!System.Web.UI.Control.InitRecursive(System.Web.UI.Control namingContainer)   Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint) Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest()  Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext context)    Unknown
System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context)    Unknown
App_Web_g2ej3jrk.dll!ASP.common_breakoutdialog_aspx.ProcessRequest(System.Web.HttpContext context)  C#
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  Unknown
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)  Unknown
System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error)    Unknown
System.Web.dll!System.Web.HttpApplication.ResumeStepsFromThreadPoolThread(System.Exception error)   Unknown
System.Web.dll!System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(System.IAsyncResult ar)    Unknown
System.Web.dll!System.Web.HttpAsyncResult.Complete(bool synchronous, object result, System.Exception error, System.Web.RequestNotificationStatus status)    Unknown
System.Web.dll!System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(object state)   Unknown
mscorlib.dll!System.Threading.TimerQueueTimer.CallCallbackInContext(object state)   Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
mscorlib.dll!System.Threading.TimerQueueTimer.CallCallback()    Unknown
mscorlib.dll!System.Threading.TimerQueueTimer.Fire()    Unknown
mscorlib.dll!System.Threading.TimerQueue.FireNextTimers()   Unknown
mscorlib.dll!System.Threading.TimerQueue.AppDomainTimerCallback()   Unknown
[Native to Managed Transition]      

差异发生在
System.Web.HttpApplication.ResumeStepsFromThreadPoolThread()
再次调用
ResumeSteps()
的地方,最终再次调用
Page_Init()

两件事导致了这种情况发生在我身上

  • 在HTML图像标记中有一个空白的src元素,可以有效地向同一页面发出另一个请求。比如说,
  • 有两件事联系在一起。在VB中,当方法上有一个显式handles子句,并且它也通过设计器连接时,就会发生这种情况。您可能更喜欢显式地连接事件并关闭自动事件连接(这也适用于C)

  • 可能有很多事情,但img标签经常出现。

    如果是#1,我应该在F12开发者工具中看到第二个网络请求,对吗?我没有看到#2:我在ASPX中设置了
    AutoEventWireup=“false”
    ,并且
    this.Init+=new System.EventHandler(this.Page\u Init)到构造函数,我仍然有相同的结果。@Hillboy,谢谢,我看到了,但似乎没有一个适用。