Page_Init()被调用两次

时间:2014-10-08 15:50:01

标签: asp.net

我的页面的Page_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()的位置。

1 个答案:

答案 0 :(得分:0)

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

  1. HTML图片代码中有一个空白的src元素,可以有效地向同一页面发出另一个请求。例如,
  2. 连接了两个事件。在VB中,当您在方法上有一个显式句柄子句并且它也通过设计器连接时会发生这种情况。您可能更喜欢明确地连接事件并关闭自动事件连线(这也适用于C#)。
  3. 可能有很多东西,但img标签发生了很多。