If you have set a breakpoint in the page_load event of your web form and have found it fires twice, view source on the page and check for anything that uses a src="" attribute that is either empty or contains number sign (src="#").
If you find one, make sure you set it to something, if it is an image
find a spacer.gif or something you can use, if it is a script or an
Iframe either set it or remove it. If you think about it this makes perfect sense, an image tag with an empty src attribute will end up calling the page as the source, which will fire the page load event again. In my case, I was using an
<asp:image> tag that had no imageurl until the submit button
was pushed and a green check mark or red cross was assigned to it as
part of an onscreen Success/Failure message. Making it default to the
check mark image resolved my issue. While researching this I found these other possible causes:
- Check to see if AutoEventWireUp is set to false in the page/control directive.
- If you are using Visual Basic, check to see that your Handles keyword is only handling one event:"Handles MyBase.Load, Me.Load" would cause it to fire twice.
- If it only happens on postback, check that your Javascript form validation does not end with form.submit() which would effectively submit your form twice.