Build script for an ASP.NET MVC project

April 18, 2010 20:44

Building a project from command line gives you more control over the build process and provides quite a few other interesting options - comparing to building from Visual Studio.

And recently your humble correspondent was thinking about a "perfect build script" for an ASP.NET MVC project.

What should it have? Here's my take:

  • Option to pre-compile views. Errors in views are not detected until run time but MvcBuildViews property is your compile time friend (pre-compiling the views is not fast, so it's switched off by default).
  • Option to run a clean build. Cached dlls are lurking around every bend so there must be a way to clean up everything. 
  • Non-removable unit tests runner. Even if running all your unit tests takes ages, there must be a set of "smoke" unit tests that verify your basics.


Sending HTML emails with ASP.NET MVC2 and MVCContrib

March 14, 2010 21:45
Recently I was playing with ASP.NET MVC2 trying to find a neat solution for sending emails. This post is a sum-up of that little endeavour.

From it you will learn
  1. How to send HTML emails with MVCContrib and its EmailTemplateService
  2. How to test email sender without SMTP server
  3. How to use Ninject with MVC controllers

Send HTML emails with ASP.NET MVCAll those impatient readers out there, go ahead and download the source code of a small app that will be crafted in the rest of this post (zip comes along with MVCContrib source code, for some rich debugging experience).

ASP.NET MVC security checklist

February 7, 2010 19:43

There are tons of good papers[1] and a bunch of questions on StackOverflow[2] about designing and developing for security, but all of them seem to concentrate on what you should do.

However, recently I was after something different: a
"visit a page, try this and that" kind of things, you know. A list of simple actions one should to go through once development is done, to make sure the solution is secure.

Here's something I've come up with so far:


Type safe route registration in ASP.NET MVC

October 18, 2009 17:25

A few days ago my workmate Ian made a point that there should be a nice way to implement type safe route registration in ASP.NET MVC.

Type safe! Can anyone read these words without experiencing a tug of excitement, without being swayed by the view of departed bugs and newly arrived refactorings on controllers and actions - refactorings that don't break your app?

Indeed, type safe is possible. Here's how we register our routes now:

    new { controller = "Product", action = "Display", mode = "full" }  
and here's a type safe way:

     .On<ProductController>(x => x.Display("full"));