我想知道为什么无法加载All Js和Css文件夹?
我有一个前端视图的文件夹FrontTheme
在这个文件夹中有2个文件夹css
和js
,我想在包中的FrontTheme
文件夹中加载所有js和css文件
我的代码是:
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
// bundles.Add(new ScriptBundle("~/Content/Admin/js").IncludeDirectory("~/Content/Admin/assets/", "*.js",true));
// bundles.Add(new StyleBundle("~/Content/Admin/css").IncludeDirectory("~/Content/Admin/assets/", "*.css",true));
bundles.Add(new ScriptBundle("~/Content/FrontTheme/js")
.IncludeDirectory("~/Content/FrontTheme/js", "*.js",true));
bundles.Add(new StyleBundle("~/Content/FrontTheme/css")
.IncludeDirectory("~/Content/FrontTheme/css", "*.css",false));
#if DEBUG
BundleTable.EnableOptimizations = false;
#else
BundleTable.EnableOptimizations = true;
#endif
并且在视图中我使用:
@Scripts.Render("~/Content/FrontTheme/js")
@Styles.Render("~/Content/FrontTheme/css")
但是捆绑包没有加载css和js文件,浏览器让我获得403禁止状态。
--- ---更新 即使我将包名更改为
~/Content/FrontThemejs
~/FrontTheme/js
~/FrontThemejs
~/Frontjs
Frontjs
~/123/js
~/Content/FrontThemecss
~/FrontTheme/css
~/FrontThemecss
~/Frontcss
Frontcss
~/456/css
但403
的状态代码更改为404
Failed to load resource: the server responded with a status of 404 (Not Found)