[英]Error in web.config “location”
My site has 2 logins. 我的网站有2次登录。 1 on the front end for regular users, and one in the admin section, for admins (I need 2 logins because each one asks for different login criteria). 对于常规用户,前端为1,管理员部分为1,对于管理员(我需要2次登录,因为每个人都要求不同的登录标准)。 To authenticate the admin directory, I setup a "location" element in my main site's web.config like this: 要验证admin目录,我在主站点的web.config中设置了一个“location”元素,如下所示:
<location path="Admin">
<system.web>
<authentication mode="Forms" >
<forms loginUrl="/Accounts/adminLogin.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
If I try to type any page from my "Admin" directory, into my browser, I get the following error: 如果我尝试从我的“管理”目录中键入任何页面,进入我的浏览器,我会收到以下错误:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. 在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的。 This error can be caused by a virtual directory not being configured as an application in IIS. 此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的。
How can I setup my location element to redirect properly? 如何设置我的位置元素以正确重定向?
Thanks 谢谢
There are mainly one of the two reason why you got this error message. 您收到此错误消息的原因主要有两个。
Check the web.Config in your admin folder and main root folder for settings and configurations. 检查管理文件夹和主根文件夹中的web.Config以获取设置和配置。
You can't change the Authentication mode within a subdirectory. 您无法在子目录中更改身份验证模式。 Only WebApplications can define this setting which applies to the entire application. 只有WebApplications可以定义适用于整个应用程序的此设置。 A location element is only used in subdirectories to change authorization, not authentication settings. location元素仅在子目录中用于更改授权,而不是身份验证设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.