ASP.NET MVC Preview Release 4
To my delight I noticed that during my vacation the ASP.NET MVC Preview Release 4 have been released. This is nice since I’ve been trying to wrap my head around this framework for a project I’m currently working on.
The MVC framework certainly solves a lot of the issues I have with ASP.NET and actually makes it possible to create standard compliant websites without having to bend over backwards with all the awkward quirks of the ASP.NET Web Forms model.
Scott Guthrie has written about the new release, describing what’s different from the last one. One thing that I found particular nice is that it’s now really easy to implement functions for handling logins and such. The new template even includes basic examples that you can easily adapt to your own needs.
Action Filter Attributes
Action filters is a way to intercept an Action Method and perform something before and/or after it has been executed. They are not new since they been around since preview release 2, but the news is that there are some really useful ones built in. You can also easily make your own.
They are very easy to use. You just define them on a class within a Controller or directly on an Action Method like this:
Public Class ClassName : Controller
public object MethodName()
Two of the built in filters I find most interesting are the OutputCache Filter and the Authorization Filter. The OutputCache Filter enables you to easily cache certain content via ASP.NET’s output cache features. The Authorization Filter lets you integrate authorization control on different content in a very simple manner. This in combination with the built in user handling makes it really easy to build websites with login functionality.
To read more about these enhancements and others, visit Scott Guthris blog.