-
ASP.NET MVC 3 & Unity 2.0: Using XML configuration for design-time configuration
Introduction In one of my blog post “ASP.NET MVC 3: Dependency injection with Unity 2.0” I explained how to use the Unity 2.0 dependency injection (DI) container in an ASP.NET MVC 3 web application. The example shown in this previous post uses run-time configuration to set up the DI container. A drawback of run-time configuration […]
-
ASP.NET Membership Provider: Changing user password without knowing the old one
If you want to change a membership user’s password with the MembershipUser.ChangePassword method you need to know the user’s old password. The following extension method defines a SetNewPassword method that enables you to reset the password without knowing the old one: public static class MembershipUserExtension { /// /// Set a new password for the membership […]
-
ASP.NET MVC3: Controller extension methods to render a partial view to string
To handle AJAX form requests in my ASP.NET MVC3 controller I needed a way to render a partial view to a string to return a JSON result containing both the (server-side) validation result (as boolean) and a rendered partial view (as string). Unfortunately in ASP.NET MVC3 there seems no out-of-the-box support for rendering partial views […]
-
ASP.NET MVC: Fix IControllerFactory implementation after upgrading from MVC 2 to MVC 3
Recently, I upgraded an ASP.NET MVC 2 application to ASP.NET MVC 3. I used the ASP.NET MVC 3 Application Upgrader tool (see this blog post for more information) which enables you to upgrade an existing MVC 2 project automatically. After the upgrade process I got an compile error in my custom controller factory, because the […]
-
ASP.NET MVC: How to add ELMAH (Error Logging Modules and Handlers for ASP.NET)
In this tutorial, you will find a step by step instruction how to add ELMAH (Error Logging Modules and Handlers for ASP.NET) to your existing ASP.NET MVC application. ELMAH is an easy-to-plug in library that logs and reports unhandled exceptions in ASP.NET application. It is described as follows: ELMAH (Error Logging Modules and Handlers) is […]
-
ASP.NET MVC: How to use Apache’s log4net logging framework
This blog post will give an short overview of the steps needed to integrate the Apache log4net logging framework to an ASP.NET MVC 3 Web application. For simplicity, we are starting from a new ASP.NET MVC 3 Web application and choose the “Internet Application” template to have some default controllers and views. To include the […]