【发布时间】:2016-10-05 21:36:52
【问题描述】:
我有 ASP.NET 网站。
我可以访问公共页面,没关系:
但是当我尝试访问该文件夹时收到 403 错误:
MyPublicFolder 包含 index.htm。
我要不允许用户浏览目录,只能访问文件夹中的所有页面。
我们有以下错误:
403 - 禁止:访问被拒绝
您无权使用 您提供的凭据。
<location path="/MyPublicFolder">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
我使用的是 IIS 7.5,Windows Server 2008 R2。
有什么建议吗?
更新:web.config
注意:v1 是我的公共文件夹
<location path="v1">
<system.web>
<authorization configSource="Config\system.web.authorization.allow.config" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="index.htm"/>
</files>
</defaultDocument>
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*" destination="/v1/index.htm" />
</httpRedirect>
</system.webServer>
</location>
<location path="v1/index.htm">
<system.webServer>
<httpRedirect enabled="false" />
</system.webServer>
</location>
【问题讨论】:
-
你想让你的用户浏览你的目录吗?
-
我要不允许用户浏览目录,只能访问文件夹中的所有页面。 MyPublicFolder 包含 index.htm。
标签: asp.net path url-redirection http-status-code-403