Wednesday, November 24, 2010

Using Web Helpers in ASP.Net MVC 3

If you had been following the development of WebMatrix and Razor view engine, you would have found a new way of developing cool features in form of Web Helpers. Now if you want to implement same cool factor in your ASP.Net MVC 3 application or ASP.Net web application, you won’t be able to do it at least with ASP.Net MVC release candidate.

Reason being most of those web helpers like @Bing, @Twitter, @Video, @ReCaptcha, @FileUpload etc. are defined in “Microsoft.Web.Helpers.dll” which is not part of either WebMatrix Beta or ASP.Net MVC RC installation. To get this dll you will need to get a “micorosft-web-helpers” library package from internet. http://www.mikesdotnetting.com/Article/162/Using-Web-Pages-Helpers-in-ASP.NET-Web-Forms is the link where author is details out each step needed to download “microsoft-web-helpers” package from internet repository. He also details out how to use these web helpers in vanilla ASP.Net Web forms application.

Once you download this library package, then you can use each and every web helper in your ASP.Net MVC 3 application or in ASP.Net Web form application too.

Starting with WebMatrix/Razor view engine

As ASP.Net MVC 3 RC is released, Razor view engine should start getting more and more adoption. To start learning Razor here is a great start. Though this link seems to be talking about WebMatrix but WebMatrix is nothing but Razor view engine. There are bunch of articles which are talking about analytics, captcha etc which are equally applicable to ASP.Net MVC 3. Overall a very good kick start for understanding Razor view engine.