So I was going through some code of codebettercanvas and found it interesting of Karl Seguin using Html Helper extension for his form tags, which has its elegance.


Basically it calls an extension method called LinkTo with a generic controller and a lamda for calling its action, the extension method looks like

This would work great if you are using IIS 7 or some kind or rewrite in your URL but if you are using IIS 6, where you might need some special extension in your routes for IIS 6 to surf ASP MVC e.g {controller}.mvc/{action}/{id} pattern. (Steve Sanderson does a post on deploying it on IIS 6) Then you are out of luck to use the html helper extension method form tag. Since the application path does not know about the .mvc extension you added to the route.

But not to worry one can use the UrlHelper class to find the path. Here is an example of it.

Now all you have to do is use this in your form e.g

Please note I am using sparkviewengine for my views in my asp mvc