使用注册为allowDefinition =' MachineToApplication'的部分是错误的.超出应用程序级别. [英] It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

查看:45
本文介绍了使用注册为allowDefinition =' MachineToApplication'的部分是错误的.超出应用程序级别.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的错误是

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.  C:\Users\Jangid\Downloads\TestWebSite1\TestWebSite1\Backup\TestWebSite1\Web.config  26

我已经在使用ASP.Net 2.0的服务器中托管了一个网站,我在根文件夹中有一个web.config,在Admin文件夹中也有一个,但是admin文件夹不是虚拟目录,因此我不想创建

I have hosted a website in a server using ASP.Net 2.0, i have a web.config in the root folder and also one in the Admin folder, but the admin folder is not a virtual directory and i dont want to create.

<authentication mode="Forms">
  <forms loginUrl="Admin/Login.aspx" name=".ASPXFORMSAUTH"/>
</authentication>
<authorization>
  <allow roles="Admins"/>
  <deny users="*"/>
  <deny users="?"/>
</authorization>

但是对于Admin文件夹的身份验证和登录工作,我使用了ASP.Net登录控件,但是此错误阻止了我前进.

But for authentication and login work for Admin folder, i have used ASP.Net Login Control, but this error preventing me to move formward.

也请任何人给我一个用于学习ASP.Net登录控件的链接,例如访问Admin文件夹的用户应以Role身份验证为admin,如何在服务器上创建角色并分配给用户

And also please can any one give me a link for learning ASP.Net Login Control, Like user who visit Admin folder should be authenticated with a Role as admin, How can i create a Role and assign to user on a server

推荐答案

<system.web>       
    <authentication mode="Forms"> 
        <forms name="cokiename" 
            loginUrl="./protectedFolder/login.aspx" 
            protection="All" 
        timeout="60" 
        defaultUrl="./protectedFolder/protectedPafe.aspx"/> 
  </authentication> 
</system.web>

这应该在您的主要web.config文件中

This should be in your main web.config file

以下内容进入您的子目录配置

Following goes into your sub directory config

<configuration> 
<system.web> 

  <customErrors mode="Off"/> 
    <authorization> 
      <deny users="?" /> 
    </authorization> 

</system.web> 
</configuration> 

受保护的文件夹包含登录页面,受保护的页面和web.config

protected folder contains the login page, protected pages and the web.config

这篇关于使用注册为allowDefinition =&amp;#39; MachineToApplication&#39;的部分是错误的.超出应用程序级别.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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