在web.config中多个/不同的身份验证设置 [英] Multiple/Different authentication settings in web.config

查看:182
本文介绍了在web.config中多个/不同的身份验证设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会如何对我的web应用程序的不同部分设置不同的认证标签?说我有:

  /
/文件夹1 /
/资料夹/

有没有可能指定不同的<认证/>为每个文件夹标签

我想folder1中使用Windows身份验证,但文件夹2使用Forms身份验证。

我试着做了<位置/> 标记,但它并不像你可以有<认证/> 在标记的<位置/方式> 标签,至少不是通过VS 2008与它的内置Web服务器

这个错误了说 - 错误三是使用注册为allowDefinition =应用程序级别之外'MachineToApplication'的节是错误的。这个错误可以通过未被配置为在IIS中应用程序的虚拟目录引起的。

 <位置路径=/文件夹1>
    <&的System.Web GT;
      <身份验证模式=表格/>
      <授权>
        <拒绝用户= /&gt的帮助?
      < /授权>
    < /system.web>
  < /地点>


解决方案

您只能<认证/> 在顶层 web.config中。您可能需要创建多个应用程序。即你可以在应用程序中创建一个应用程序,并在每一个使​​用不同的身份验证模式。

How would I go about setting different authentication tags for different parts of my web app? Say I have:

/
/folder1/
/folder2/

Would it be possible to specify different <authentication/> tags for each folder?

I want folder1 to use Windows authentication but folder2 use Forms authentication.

I tried doing in a <location/> tag but it doesn't look like you can have <authentication/> tags in a <location/> tags, at least not via VS 2008 with it's built in webserver.

This errors out saying - Error 3 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.

<location path="/folder1">
    <system.web>
      <authentication mode="Forms" />
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

解决方案

You can only have <authentication /> on the top level web.config. You may have to create multiple applications. ie you can create an application within an application and use different authentication modes in each one.

这篇关于在web.config中多个/不同的身份验证设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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