Page_Init()被调用两次
问题描述:
我的网页Page_Init()
方法被称为第一次显示了两次了。在这两种情况下,IsPostBack == false。我有AutoEventWireup="true"
集。下面是当被呼叫这两种堆栈跟踪:Page_Init()被调用两次
第一次调用:
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中,当你在一个方法上有一个明确的句柄子句时,它会发生,并且它也通过设计器连接起来。您可能更愿意明确地连接事件并关闭自动事件连接(这也适用于C#)。
这可能是很多事情,但img标签发生了很多。
+0
如果它是#1,我应该在F12 Developer Tools中看到第二个网络请求,对吧?我没有看到任何。 #2:我设置'AutoEventWireup = “假”'在ASPX和'this.Init + =新System.EventHandler(this.Page_Init);'给构造和我仍然有相同的结果。 – ariscris 2014-10-08 16:10:15
http://*.com/questions/1138505/asp-net-page-init-fired-twice – Hillboy 2014-10-08 17:31:26
@Hillboy,谢谢,我看到了,但没有它似乎适用。 – ariscris 2014-10-08 18:08:26