设为首页收藏本站

就爱编程论坛

 找回密码
 注册

人人连接登陆

无需注册,直接登录

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 1167|回复: 5
打印 上一主题 下一主题

It is an error to use a section registered as allowDefinition='MachineToApplica [复制链接]

Rank: 9Rank: 9Rank: 9

  • TA的每日心情
    无聊
    2025-5-27 03:37:20
  • 签到天数: 366 天

    [LV.9]以坛为家II

    论坛先锋 学习至圣 荣誉成员 论坛元老 活跃之星 终极领袖

    我玩的应用:

    跳转到指定楼层
    楼主
    发表于 2011-5-14 09:49:40 |只看该作者 |倒序浏览
    You may receive the error "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level" in asp.net

    You may get this error when trying to browse an asp.net application.

    The debug information shows that "This error can be caused by a virtual directory not being configured as an application in IIS."

    However, this error occurs primarily out of 2 scenarios.

    1. When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application.
    However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and
    may get the above error. The debug information you get as mentioned above, is applicable to this scenario.

    To resolve it, Right Click on the virtual directory - select properties and then click on "Create" next to the "Application" Label and the textbox. It will
    automatically create the "application" using the virtual directory's name. Now the application can be accessed.


    2. When you have sub-directories in your application, you can have web.config file for the sub-directory. However, there are certain properties which cannot
    be set in the web.config of the sub-directory such as authentication, session state (you may see that the error message shows the line number where the
    authentication or sessionstate is declared in the web.config of the sub-directory). The reason is, these settings cannot be overridden at the sub-directory level
    unless the sub-directory is also configured as an application (as mentioned in the above point).

    Mostly we have the practice of adding web.config in the sub-directory if we want to protect access to the sub-directory files (say, the directory is admin and we
    wish to protect the admin pages from unathorized users).

    But actually, this can be achieved in the web.config at the application's root level itself, by specifing the location path tags and authorization, as follows:-

    <location path="Admin">
    <system.web>
    <authorization>
    <allow roles="administrators" />
    <deny users="*" />
    </authorization>
    </system.web>
    </location>

    However, if you wish to have a web.config at the sub-directory level and protect the sub-directory, you can just specify the Authorization mode as follows:-

    <configuration>
    <system.web>
    <authorization>
    <allow roles="administrators" />
    <deny users="*" />
    </authorization>
    </system.web>
    </configuration>

    Thus you can protect the sub-directory from unauthorized access.

    Cheers.

    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    分享分享0 收藏收藏0 支持支持0 反对反对0 分享到人人 转发到微博
    [img=http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=fRUcHhYWGAQ9GxIFEBwUEVMeEhA]http://rescdn.qqmail.com/zh_CN/htmledition/images/function/qm_open/ico_mailme_02.png[/img]

    使用道具 举报

    Rank: 2

    升级 
     
    0%

    该用户从未签到

    沙发
    发表于 2011-9-8 17:14:04 |只看该作者

    使用道具 举报

    Rank: 2

    升级 
     
    50%

    该用户从未签到

    板凳
    发表于 2011-9-12 09:02:08 |只看该作者
    看看吧....













    使用道具 举报

    Rank: 2

    升级 
     
    43.33%

    该用户从未签到

    地板
    发表于 2011-9-12 20:47:16 |只看该作者
    謝謝,希望以後多些












    www.zzdfmd.com www.52pscn.com

    使用道具 举报

    Rank: 3Rank: 3

    升级 
     
    52.33%

    该用户从未签到

    5#
    发表于 2011-10-6 15:54:49 |只看该作者

    使用道具 举报

    Rank: 3Rank: 3

    升级 
     
    46.33%

    该用户从未签到

    6#
    发表于 2011-10-17 04:32:16 |只看该作者

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册 人人连接登陆

    晴云孤魂's Blog|就爱编程搜帖|手机版|Archiver|就爱编程论坛     

    GMT+8, 2025-7-1 19:17 , Processed in 0.092627 second(s), 36 queries .

    Powered by Discuz! X2

    © 2001-2011 Comsenz Inc.

    回顶部