收到以下错误:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

这就是我链接CSS文件的方式.

<link rel="stylesheet" type="text/css" href="~/styles/StyleSheet.css" />

我是第一次使用母版页.我在ISS服务器上添加了母版页. 我在我的ISS 8.0中启用了目录设置

推荐答案

您是否try 过在web.config文件中设置以下内容:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

Asp.net相关问答推荐

缓存httpmessage内容

JWT 和 Google 在 Razor 页面中进行身份验证和授权

内容根路径在 .NET 6 中如何工作?

cookie 存储在系统的什么位置?

ASP.Net - App_Data & App_Code 文件夹?

返回 HttpResponseMessage 时的 WebAPI Gzip

如何在 IISExpress 上使用带有 localhost 的子域?

有没有办法将 onclick 事件添加到 ASP.NET 标签服务器控件?

在 RedirectToAction 调用中传播 QueryString 参数

使用 Lucene.NET 索引 .PDF、.XLS、.DOC、.PPT

HttpContext.Current.Request.IsAuthenticated 和 HttpContext.Current.User.Identity.IsAuthenticated 有什么区别?

System.Web.MVC 自 MS14-059 以来未复制到 bin 文件夹中.如何防止由于 Windows 更新而创建缺少 DLL 的构建?

缩小失败.返回未缩小的内容

从后面的 asp.net 代码中读取表单身份验证 cookie

如何将图像 url 转换为 system.drawing.image

如何在实体框架中添加表?

如何在 ASP.NET 中设置下拉列表项?

不同域的登录页面

MVC4 - 当优化设置为 true 时Bundle 不起作用

Visual Studio 2013 ASP.NET 项目中 Antlr 包的用途是什么?