Tsar Tsar - 1 year ago 241
ASP.NET (C#) Question

Create a Script bundle from multiple CDN locations

Let's assume our app is offline, i.e. we can't use 3rd party CDNs thus we're creating our own.
I'd like to host all of the vendor scripts in a separate (Parent) web app and then include them in the bundles in several other MVC Apps.


  • http://localhost/parentWeb/Scripts/jquery.js

  • http://localhost/parentWeb/Scripts/jquery-ui.js

  • http://localhost/parentWeb/Scripts/globalize.js

I'd like to include in the ASP.NET MVC App Website located in:

i.e. do something like this:

bundles.UseCdn = true;
new ScriptBundle(

...which of course isn't currently possible. Is there a good workaround?

Answer Source

I have found a solution, which has nothing to do with CDN. Basically, granted the childWeb is hosted in the parentWeb's subdirectory, the following bundle configuration in the childWeb apps picks the file from the parentWeb and bundles them as usual:

    new ScriptBundle(

the important bit being: ~/../, which takes you one level up from the root location.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download