首页 > 解决方案 > 在 Visual Studio 中运行 asp.net mvc Web 应用程序时无法在 Web 浏览器中加载 CSS 和 Javascript 属性

问题描述

在运行使用 Visual Studio 2019 开发的 asp.net mvc Web 应用程序时,我无法加载 CSS 属性。我使用了布局页面 (_Layout1.cshtml) 并创建了一个视图“索引”,它继承了布局页面。在布局页面中,我使用了 html 页脚和页眉。

我尝试使用“@Url.Content”属性指定我创建的 myContent 文件夹下存在的 css 和 js 文件的路径。我没有收到任何错误,我只能看到浏览器中的文本,但没有加载 css。请找到屏幕截图以便更好地理解。

我只获得内容,但没有在浏览器中获得 CSS 和 js 属性:图片在这里

这是我在 cshtml 文件中 head 标签下的 html 代码的一部分:

<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<title>Destino</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Destino project">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href=@Url.Content("/myContent/styles/bootstrap4/bootstrap.min.css")>
</head>

标签: c#asp.net-mvcvisual-studio-2019

解决方案


推荐阅读