Earlier today, I ran into a rather annoying issue that was painfully hard to debug and narrow down the cause. While debugging some functionality that executed on a postback, I had a breakpoint in my page .cs located at the start of our old friend, Page_Load. So, it turns out my logic was working just fine on the postback call, but once that Page_Load handler finished its run, low and behold, my breakpoint was hit again?!
This second run through was not being treated as a postback, so a lot of my page initialization code was firing and undoing some changes that were just done on my postback. After a painfully long time of commenting out C# code and javascript and not being able to reproduce the problem, I finally narrowed it down to the following line in my .aspx markup.
Well it turns out that setting the src attribute to blank indicates that you are self referencing the page that the img resides on. Thus, my Page_Load event would fire a second time. If you're wondering why there is a blank src attribute, the intention was to populate it via javascript at a later point. The potential fixes are:
1) Not specifying the src attribute at all. This however violates w3c standards and will also give you annoying warning messages within Visual Studio
2) Just add a spacer image and set the src attribute to that.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.