尝试重定向时公用文件夹中的403禁止错误 [英] 403 Forbidden error in Public Folder when I try redirection

查看:130
本文介绍了尝试重定向时公用文件夹中的403禁止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ASP.NET网站.

I have ASP.NET site.

我可以访问公共页面,没关系:

I can access to the public page, it's OK:

http://mysite/MyPublicFolder/index.htm

但是尝试访问该文件夹时出现 403错误:

But I get 403 error when I try access to the folder:

http://mysite/MyPublicFolder/

MyPublicFolder包含 index.htm .

MyPublicFolder contains index.htm.

我要不允许用户浏览目录,仅允许访问文件夹中的所有页面.

我们遇到以下错误:

403-禁止访问:拒绝访问

403 - Forbidden: Access is denied

您无权使用以下命令查看此目录或页面 您提供的凭据.

You do not have permission to view this directory or page using the credentials that you supplied.

<location path="/MyPublicFolder">
  <system.web>
     <authorization>
        <allow users="*"/>
     </authorization>
  </system.web>
 </location>

我正在使用IIS 7.5,Windows Server 2008 R2.

I am using 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>

推荐答案

听起来有些混乱.您说的是可以打开http://mysite/MyPublicFolder/index.htm,这意味着您已经可以访问此文件夹中的所有页面.我只能猜测您希望在访问文件夹时将重定向到index.htm文件.在IIS管理器中签出默认文档"部分,并确保其中有index.htm.

It sounds a bit confusing. You are saying that you can open http://mysite/MyPublicFolder/index.htm what means that you have already got an access to all the pages located in this folder. I can just guess that you expect to get a redirect to index.htm file when you access a folder. Check out Default Document section in the IIS manager and make sure that index.htm is there.

更新:

您的web.config文件中似乎有很多无用的配置.将其更改为以下内容:

Looks like there are a lot of useless configuration in your web.config file. Change it to the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="v1">
    <system.web>
      <authorization configSource="Config\system.web.authorization.allow.config" />
    </system.web>
  </location>
</configuration>

现在,如果您访问v1文件夹,它将自动向您显示index.htm文件的内容.

Now if you access your v1 folder it should automatically show you content of your index.htm file.

这篇关于尝试重定向时公用文件夹中的403禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆