Author: smart1 | Posted on: 4/2/2006 4:25:30 AM | Views : 271

This bug has essentially drained an entire day.  I found that when I add an image control (one of the controls that ship with ASP.NET 2.0) to a page, that the Page_Load event fires twice -- once on page load and again when the Image is rendered.  This occurs even if I bury the image in a user control; the image will still force the containing page's Page_Load event to fire twice.

Here's how to recreate it:

Start a new blank Web Site.
Go to the designerDrop an image control on the pageGo to the code viewAdd a break point to page_loadRun the debugger... see the page_load fire twice.This is extremely weird, and unexpected.  Is this a bug in ASP.NET 2.0?  Why on earth would this happen, and what is a work around?

-John Smart
Microsoft FTE as of May 30 2006

...

Go to the complete details ...