Strongly typed action links in ASP.NET MVC

Once upon a time (back before preview 5 of ASP.NET MVC), you could link to controller actions in a strongly typed manner, like so:

– but due to some design decision, this particular overload is not immediately available anymore.

Fortunately, it has not been deleted from the world – it has just been moved to the Microsoft.Web.Mvc assembly – also known as ASP.NET MVC Beta Futures which is sort of an experimental playground where the MVC team put features that might be implemented as part of the official MVC release.

So, if you realize that your routes are mapped 1:1 directly to your controller methods, then why not reference the aforementioned assembly and add the following to your web.config:

– thus bringing back the sweet strongly typed lambda-enabled action link overload.

One thought on “Strongly typed action links in ASP.NET MVC

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.