Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Page.OnLoad executes twice

Tags:

asp.net

Anyone have any idea when and why Page.OnLoad() executes twice in the ASP.NET lifecicle?

like image 379
Adrian Zanescu Avatar asked Mar 04 '09 10:03

Adrian Zanescu


People also ask

What is OnLoad in asp net?

ASP.NET calls this method to raise the Load event. If you are developing a custom control, you can override this method in order to provide additional processing. If you override this method, call the base control's OnLoad method to notify subscribers to the event.


3 Answers

Do you have a an IMAGE element with a blank string for the URL on that page?

This one has caught so many people before :)

like image 118
leppie Avatar answered Sep 28 '22 07:09

leppie


Make sure you don't have any tags like <img src="#"> or <img src="">, that makes IIS load the page twice. It's a classic.

like image 31
axel_c Avatar answered Sep 28 '22 06:09

axel_c


Do you have AutoEventWireUp set to true and also attaching an event handler in code? This is a common reason.

like image 44
mmx Avatar answered Sep 28 '22 07:09

mmx