Groups | Blog | Home
all groups > asp.net > february 2005 >

asp.net : aspx pages load twice


Sylvain Lafontaine
2/11/2005 8:25:32 PM
Most of the time, this is caused by the property AutoEventWireup set to true
instead of false.

S. L.

[quoted text, click to view]

surveyor04
2/11/2005 8:54:08 PM

Can someone help me try to figure out why my pages load twice? While
debugging other issues, I notice that a great many of my pages run
through the onload method twice, and sometimes they run through the
onclick method of buttons two times as well. As far as onlick is
concerned, I checked the .NET designer code and there is only 1 event
handler wired up, so I don't know why these actions are occuring in
duplicate. Is there a way to trace through and find out why?



--
surveyor04
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
Ken Cox [Microsoft MVP]
2/11/2005 10:51:12 PM
Are you running with ASP.NET 1.1 sp1?

Microsoft .NET Framework 1.1 Page_Load Event Fires Two Times

http://support.microsoft.com/kb/827801

http://support.microsoft.com/kb/885055


[quoted text, click to view]
Patrick Olurotimi Ige
2/13/2005 9:52:38 PM
Try setting AutoEventWireup set to false..
Cos i think by default its true.I had the smae problem once but this
fixed it..
Patrick



*** Sent via Developersdex http://www.developersdex.com ***
Brian
2/13/2005 10:08:09 PM
I've had large chunks of code execute twice, due to bad programming on my
part.

Sometimes I needed to add a if(!Page.IsPostBack){ ... } wrapper to certain
function calls to make sure they only executed on the intial page load..
other times, I had certain objects or user controls with ViewState enabled
(which is default) but not always necessary and occasionally triggered
unanticpated code execution.


[quoted text, click to view]

AddThis Social Bookmark Button