Sangram Sangram - 14 days ago 5x
ASP.NET (C#) Question Webforms Bundling & minification - Bundled script throws 404

I have been trying to implement bundling and minification for my existing webforms project and unfortunately it is ending up with 404 responses.

Let me first share the steps I have followed.

  1. Installed
    through nuget.

  2. Added
    class and registered it on Glabal.asax Application_Start event

My code to bundle the JS files.

public static void RegisterBundles(BundleCollection bundles)
bundles.Add(new ScriptBundle("~/bundles/modelJs").Include(


  1. Added following markup to aspx page

<asp:PlaceHolder runat="server">
<%: System.Web.Optimization.Scripts.Render("~/bundles/modelJs") %>

  1. set BundleTable.EnableOptimizations = true; in bundleConfig and the url formed is


I have also checked the sample project which gets added in VS2013 webforms application and surprisingly, it seems to be working fine.

I have seen many questions with similar problems on SO but was not able to solve it.


Well, the solution turns out to be very simple. Just added '/' after bundling folder which is modeljs in this case.

 bundles.Add(new ScriptBundle("~/bundles/modelJs/").Include( 

Unfortunately, I didn't find this in any available source codes so I ended up wasting a lot of time. :-/