2014-10-08 112 views
0

我的網頁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()。已經造成這發生在我身上

+0

http://stackoverflow.com/questions/1138505/asp-net-page-init-fired-twice – Hillboy 2014-10-08 17:31:26

+0

@Hillboy,謝謝,我看到了,但沒有它似乎適用。 – ariscris 2014-10-08 18:08:26

回答

0

兩件事情;

  1. 在HTML圖像標記中有一個空白的src元素,可以有效地向另一個頁面發出另一個請求。例如,
  2. 兩批活動的接線。在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