Conversion to Web Application Project Resets AutoEventWireup
Suppose you have an ASP.NET 1.x project and you want to migrate it to 2.0. You load it up in Visual Studio 2005 and run the conversion wizard.
Next, you decide to convert it to a Web Application Project (WAP), which I always recommend over the web site model. Right click the project name and select “Convert to Web Application.”
Note this: in 1.x, the default Web Form template has
AutoEventWireup="false". However, during the conversion to WAP this attribute is flipped to “true” on all pages! I had to track down every single page where this conversion took place and reset this attribute.
Also to note is that every new Web Form under WAP has
AutoEventWireup="true" set by default.
What’s the big deal with automatic event wire-up?
- I don’t like guesswork of naming event handlers. Is it
Page_OnLoad? (See an earlier post on this.)
- The compiler does not tell you if you misspelled these names.
- I’m just not comfortable with event handlers pulled out of thin air; I’d rather have them wired explicitly.
- Finally, this automagic stuff does not come for free. Why would I incur the overhead of reflection if I don’t even need it?