Using an HttpModule to Redirect a Request When an Uploaded File is Too Big

Today I wanted to build something into an ASP.NET MVC application to impose a size limit on uploaded files. I wanted to use an HttpModule so I could get at the upload before any Controllers got involved, and redirect the request if the file was too big. I did this without much fuss, but the redirect went to an ASP.NET "Maximum request length exceeded" error page. I just wanted to do a redirect, darnit!

Self-Configuring Enterprise Library Validation

A recent project used Enterprise Library Validation to validate domain objects, and needed it configured for a web front end, a WCF front end, and (of course) unit tests. The same configuration in 3 different places didn't strike me as very DRY, so I figured hey - why not have it configure itself? Here's a quick paraphrase of how I did it.