C# ASP.NET MVC 5捆绑css在chrome中运行良好,但在任何其他浏览器中都无法运行
正如标题所说,当我尝试在除chrome之外的任何其他浏览器中加载我的站点时,该站点没有样式 我的捆绑包不包含它们所在文件夹的名称(我知道这是捆绑包的常见问题),而且chrome可以很好地加载捆绑包,这表明捆绑包没有实际问题 如果我在Chrome中转到捆绑css的文件夹路径(例如C# ASP.NET MVC 5捆绑css在chrome中运行良好,但在任何其他浏览器中都无法运行,c#,css,asp.net-mvc,C#,Css,Asp.net Mvc,正如标题所说,当我尝试在除chrome之外的任何其他浏览器中加载我的站点时,该站点没有样式 我的捆绑包不包含它们所在文件夹的名称(我知道这是捆绑包的常见问题),而且chrome可以很好地加载捆绑包,这表明捆绑包没有实际问题 如果我在Chrome中转到捆绑css的文件夹路径(例如/Content/Allcss?v=Eze8tJIZiYOA13hExK1v1hyjgjptGZUujs0uqxcErPY1),它会加载css样式表,但是在所有其他浏览器中我只会得到一个错误: 对象引用未设置为对象的实例
/Content/Allcss?v=Eze8tJIZiYOA13hExK1v1hyjgjptGZUujs0uqxcErPY1
),它会加载css样式表,但是在所有其他浏览器中我只会得到一个错误:
对象引用未设置为对象的实例
布局负责人:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
<link
href="https://unpkg.com/tailwindcss@("@^1.0/dist/tailwind.min.css")"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?
family=Montserrat:400,800&display=swap" rel="stylesheet">
@Styles.Render("~/Content/Allcss")
@Scripts.Render("~/bundles/modernizr")
</head>
更新::
事实证明,我的PostAuthenticateRequest方法试图授权查看css,但失败了,这已解决您需要设置用户代理以指定浏览器。请参阅:感谢您的回复,但事实证明我的“protectedvoid应用程序\u PostAuthenticateRequest(objectsender,EventArgs e)”方法要求验证以查看css包
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/Allcss").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}