@Blog.Author(Nandip Makwana) .LearningExperience(ASP.NET, ASP.NET MVC, IIS, jQuery & Technology Surrounding it...)

November 24, 2012 comment , ,

ASP.NET web optimization framework with MVC 3 & ASP.NET 4.0 web form

Yesterday, I came across a forum post, where user was facing problem in integrating web optimization framework with MVC 3. So here in this post we will see how we can integrate asp.net web optimization framework with MVC 3 and ASP.NET 4.0 web form application.

Web optimization framework was introduced with MVC 4 and it is included in default MVC 4 template. But we can use it with MVC 3 and ASP.NET 4.0 web form application as well. This is because web optimization framework is built on top of framework 4.0. So here are the steps to use web optimization framework with ASP.NET 4.0 application.

  • Create new ASP.NET 4.0 web form or MVC 3 application
  • Add web optimization package by issuing following command in Visual studio package manager console
  • Now add following code in global.asax.cs
using System.Web.Optimization;
 
protected void Application_Start()
{
    Bundle commonBundle = new ScriptBundle("~/bundle/common")
        .Include("~/scripts/common.js");
    BundleTable.Bundles.Add(commonBundle);
}

Now build and browse ~/bundle/common and we can see minified version of JavaScript. So this is how we can see default bundle in action with ASP.NET 4.0 and MVC 3 application. You can refer my following post on advanced concept in web optimization framework.

Check out this index post on ASP.NET Web Optimization Framework (a.k.a Bundling & Minification) to read other post on same.

You can follow me on twitter for latest link and update on ASP.NET & MVC.

comments powered by Disqus

Featured Content

Resources & Tools

About Nandip Makwana

Nandip Makwana is passionate about digital world and web. He completed his Masters in Computer Application in June 2011. Currently he is working as a Software Engineer. He has shown great promise and command over ASP.NET and technologies surrounding it during his academic years and professorial life...continue reading