Posts Tagged ‘MVC 3’

ASP.NET: Prevent IIS 7.5 from overriding custom error pages with IIS default error pages

I’ve created a ASP.NET MVC 3 application with custom error pages for HTTP status code 404 (“Not Found”) and 500 (“Internal Server Error”). I registered my custom pages in the Web.config as follows: <configuration> <system.web> <customErrors defaultRedirect="/Error/InternalServerError" mode="RemoteOnly"> <error redirect="/Error/NotFound" statusCode="404" /> <error redirect="/Error/InternalServerError" statusCode="500" /> </customErrors> </system.web> </configuration><configuration> <system.web> <customErrors defaultRedirect="/Error/InternalServerError" mode="RemoteOnly"> <error redirect="/Error/NotFound" […]

Read more…

ASP.NET MVC 3: How to stream files to clients

Streaming files to the client is very easy using ASP.NET MVC 3: The following code snippet shows an exemplary controller action “Download” that streams data to the client. If the client requests this action (e.g. by using the link [YOUR_CONTROLLER]/Download) the browser will (depending on it’s settings) start downloading the data or open the download […]

Read more…

ASP.NET MVC 3: Dependency injection with Unity 2.0

Update 2011-07-03: I’ve written a new blog post “ASP.NET MVC 3 & Unity 2.0: Using XML configuration for design-time configuration” that shows how to use XML configuration to set up the Unity dependency injection container. Update 2011-03-28: I’ve fixed an error in the Application_Start method and added a sample Visual Studio 2010 project that includes […]

Read more…