Reputation: 10056
I have something like this:
bundles.Add(new StyleBundle("~/Content/Styles/Default/Forums").Include("~/Content/Styles/Default/Forums/Main.css",
"~/Content/Styles/Default/Forums/Slider.css"));
Now, when i release my application and run it, it creates a link like this:
<link href="/Content/Styles/Default/Forums?v=8vn0bgRpB8BncmaT_onrpNlXa4t9ydK6_Fep81xhhm01" rel="stylesheet"/>
Which refers to my site directory, and access to that is disabled. But ASP doesn't let me specify files outside of the application, then how can I do it properly?
Upvotes: 2
Views: 1708
Reputation: 2782
The virtual path in the StyleBundle
constructor doesn't have to match an existing path in your application:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/Styles/Default/Forums/Main.css",
"~/Content/Styles/Default/Forums/Slider.css"));
If you want to use external files, you can use the CDN path on the bundle (you need to set the UseCDN
property to true
):
bundles.UseCdn = true;
bundles.Add(new StyleBundle("~/Content/css", "<CDN Path>").Include(
"<CDN Path>/Main.css",
"<CDN Path>/Slider.css"));
Upvotes: 4