How to implement TDD in ASP.NET WebForms

Microsoft introduced ASP.NET MVC because they thought they could make money from an untapped market – those who feel that Web Forms are too “heavyweight”, and who are programming using a lighter-weight framework. This includes those who are accustomed to the MVC paradigm. It also includes those who couldn’t figure out how to do unit … Read more

Is it possible to share a masterpage between MVC and webforms?

You can absolutely share the same master page. Your MVC master page must simply point to the WebForms masterpage via its MasterPageFile attribute. This applies your WebForms MasterPage styles to your MVC MasterPage. I am using this setup in production. The declaration on my MVC Master Page, pointing at the Web Forms Master Page: <%@ … Read more

How to use Dependency Injection with ASP.NET Web Forms

UPDATE 2019: With the introduction of Web Forms 4.7.2, there is now better support for DI. This invalidates the below. See: Wiring up Simple Injector in WebForms in .NET 4.7.2 You can use automatic constructor injection by replacing the default PageHandlerFactory with a custom one. This way you can use an overloaded constructor to load … Read more

How to capture submit event using jQuery in an ASP.NET application?

Thanks, @Ken Browning and @russau for pointing me in the direction of hijacking __doPostBack. I’ve seen a couple of different approaches to this: Hard-code my own version of __doPostBack, and put it later on the page so that it overwrites the standard one. Overload Render on the page and inject my own custom code into … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)