当项目正在FormsAuthentifications身份认证,无一文件夹(页) [英] Authentification-None for one folder(page) when the project is under FormsAuthentifications

查看:109
本文介绍了当项目正在FormsAuthentifications身份认证,无一文件夹(页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对命名空间管理asp.net 2.0 web应用。我有表身份认证方式的项目。

I have a WebApplication on asp.net 2.0 with namespace Admin. I have Form Authentification mode for the project.

    <authentication mode="Forms">
        <forms name="ASP_XML_Form" loginUrl="Login.aspx" protection="All" timeout="30"
               path="/" requireSSL="false" slidingExpiration="true"
               cookieless="AutoDetect">
        </forms>

    </authentication>

现在,我尝试共享一个文件夹(在一个页面内)不Authentificatied用户:

Now, I try to share one folder (one inside page) for not Authentificatied users:

<location path="Recovery">
    <system.web>
        <roleManager enabled="false" >
        </roleManager>

        <authentication mode="None">
        </authentication>

        <authorization>
            <allow users="*" />
        </authorization>

        <httpHandlers>
            <remove verb="GET" path="image.aspx" />
            <remove verb="GET" path="css.aspx" />
        </httpHandlers>
    </system.web>
</location>

但是当我创建共享文件夹内的页面,就不能访问该组件。
而我看​​到的错误是这样的:

But when I create the page inside the shared folder, it can't get access to the assembly. And I see the error like this:

无法加载文件或程序
  管理员或它的一个依赖。
  系统无法找到文件
  指定。

Could not load file or assembly 'Admin' or one of its dependencies. The system cannot find the file specified.

这也说明我的错误:

ASP.NET运行时错误:这是一个错误
  使用注册为一个部
  allowDefinition的='MachineToApplication'
  超越应用水平。此错误
  可以通过虚拟目录引起
  没有被配置为应用程序
  在IIS。

ASP.NET runtime error: 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.

有谁懂得分享(身份认证无)一个文件夹(页)当项目正在FormsAuthentifications?

Does anybody know how to share (Authentification None) one folder(page) when the project is under FormsAuthentifications?

推荐答案

您应该只在以下的&LT;地点&gt; 元素:

You should just have the following in your <location> element:

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

(如果你真的需要将其删除,你可以还包括处理单元)。

(If you really need to remove them, you could also include the handlers element).

无论是身份还是RoleManager元素被允许在非应用程序级Web.config,所以你不能在&LT定义它们;地点&gt; 元素。

Neither the Authentication nor the RoleManager elements are allowed in a non-application level web.config, so you can't define them in a <location> element.

编辑回应置评

对不起,澄清:你的的在你的位置元素 - &LT;认证&GT; &LT ; roleManager&GT; 元素的没有在那里(除非/恢复是在IIS中的应用程序),并肯定会导致第二个错误,你在你的问题报告,这些将允许需要删除之前的页面会不惜一切正常显示。

Sorry, to clarify: you have too much in your location element - the <authentication> and <roleManager> elements are not allowed in there (unless /Recovery is an application in IIS) and will most certainly cause the second error you are reporting in your question, these will need to be removed before the page will display properly at all.

您看到无法找到程序集的错误随处可见,或只是在恢复文件夹中的网页上?被标记为IIS中的应用程序文件夹?如果是这样,你需要在IIS中的文件夹在您的网站的二进制文件复制到/ bin文件夹下/恢复,或删除应用程序设置。

Are you seeing the "can't find assembly" error everywhere, or just on the page in the Recovery folder? Is that folder marked as an "application" within IIS? If so, you'll need to copy your site's binaries into a /bin folder under /Recovery, or remove the application settings on the folder in IIS.

我刚刚意识到,我说:授权元素中的前两个部分时,我的意思是验证要素 - 对不起,如果这糊涂

编辑回应第二个评论

基本上,IIS,你可以有一个或多个网站 - 这些都是网站的根,被定义为应用启动点

Basically, in IIS, you can have one or more web sites - these are the roots of the site, and are defined as an Application Start Point.

IIS还允许您配置一个网站的子文件夹作为应用程序以及,这可以让你做这样的事情:

IIS also allows you to configure sub-folders of a web site as an application as well, this allows you to do things like:


  • 更改配置设置,只允许在应用程序级别进行设置

  • 在不同的存储空间的网站运行的一部分

  • 在不同的用户帐户中的网站运行的一部分

不过,如果你做一个文件夹的应用程序,你需要确保所有code,它需要是可到达的,正如你已经开始了一个新的应用程序,code根/箱(或/ APP_ code)的文件夹不再受该文件夹的访问。

However, if you do make a folder an application, you will need to ensure that all the code it needs is reachable, and as you've started a new application, code in the root /bin (or /app_code) folders is no longer reachable by that folder.

通常情况下,在IIS管理器,你会点击该文件夹并删除该应用程序,使其从根继承。

Normally, in IIS Manager you would click on the folder and remove the application so that it inherits from the root.

这篇关于当项目正在FormsAuthentifications身份认证,无一文件夹(页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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