I am working on ASP.NET MVC4. The client must download all javascripts and css from other domains, such as CDN, using the bundle. I used System.Web.Optimization.
below is the code.
var bundle = new ScriptBundle("~/bundles/scripts/"); bundle.Orderer = new AsIsBundleOrderer(); bundle.EnableFileExtensionReplacements = false; bundle.CdnPath = "http://js.cusomdomainname.com"; bundle.Include("~/Scripts/jquery-1.7.1.min.js", "~/Scripts/jquery.unobtrusive-ajax.min.js", "~/Scripts/jquery.validate.min.js", "~/Scripts/jquery.validate.unobtrusive.min.js"); BundleTable.Bundles.UseCdn = true; BundleTable.EnableOptimizations = true; BundleTable.Bundles.Add(bundle); BundleTable.Bundles.IgnoreList.Clear();
in view
@Scripts.Render("~/bundles/scripts/")
But this is not rendering from another domain.
What could be the problem?
source share