Anyone have any idea when and why Page.OnLoad() executes twice in the ASP.NET lifecicle?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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 🙂
Method 2
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.
Method 3
Do you have AutoEventWireUp set to true and also attaching an event handler in code? This is a common reason.
Method 4
Another possibility is that Visual Studio browser link is enabled. To figure out what caused the issue you can inspect the Request object.

Method 5
Do you have any controls with AutoPostBack set to true ? That will cause the Page object to be recreated and therefore the PageLoad method will execute again.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0