问题描述
我有一个托管在IIS 7.5上的ASP.NET网站,如下所示:
I have an ASP.NET website hosted on IIS 7.5 as below:
我有"customwebsite.com"作为网站,并且其中有两个Web应用程序-英国和美国;我们-这样我就可以以customwebsite.com/uk& customwebsite.com/us.
I have "customwebsite.com" as the website and in it I have two Web Applications - uk & us - so that I can access these application as customwebsite.com/uk & customwebsite.com/us.
customwebsite.com目录没有任何web.config,并且只有两个文件夹用于Web应用程序us和uk.
customwebsite.com directory does not have any web.config and have only two folders for web application us and uk.
我们和英国的Web应用程序都有各自的web.config,并具有如下所示的表单身份验证:
Both us and uk web application have their individual web.config and have Form Authentication specified as below:
<authentication mode="Forms">
<forms loginUrl="/static/login.aspx" name="login" timeout="20"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
在此路径:/static,有一个包含以下内容的web.config:
At this path: /static, there is a web.config with following content:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</configuration>
当我点击我们应用程序的根URL时,网站可以正确加载,但是如果从英国加载,则会出现以下错误:
When I hit the root URL for us application, the Website loads correctly but if I loads from uk, I got the error as below:
我已经检查了文件夹安全性,并且所有必需的用户都被授予了权限,并且对于我们和英国应用程序都是相同的.
I have checked the Folder Security, and all the required users have been granted permission and are same for both us and uk applications.
我已经检查了IIS日志,以下是失败时请求的响应代码:401 0 0 1519 296
I have checked the IIS logs and below is the response codes of the request in case of failure: 401 0 0 1519 296
有人可以帮我解决这个问题.
Can someone help me resolving this issue.
推荐答案
解决了.
还有两个文件夹,其中发生了/static/login.aspx的重定向.
There was two more folders where the redirection of /static/login.aspx happens.
我们需要允许访问所有此类重定向文件夹,方法是在这些文件夹中包含以下内容的web.config文件:
We need to allow access to all such redirecting folders by having a web.config files in those folders with below content:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</configuration>
这篇关于访问被拒绝-401.2:未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!