MVC3多个区域进行不同的验证方法 [英] MVC3 Multiple Areas Different Authentication Methods

查看:160
本文介绍了MVC3多个区域进行不同的验证方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下结构为我的Web应用程序:

I have the following structure for my web application:

在我的根web配置,而不​​是在地区/行政/ Web.Config中我有以下几点:

In my root web config, not in the Areas/Admin/Web.Config I have the following:

  <location path="Areas/Admin">
    <system.web>
      <authentication mode="Windows"></authentication>
      <authorization>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

我有我自己的身份验证网站上的主根工作使用 [授权] 标签没有问题。

现在的区/管理员,我想使用Windows身份验证。

Now for the Areas/Admin I'd like to use Windows Authentication.

在IIS(Server 2008 R2中机),我有配置为应用程序管理文件夹:

In IIS (Server 2008 R2 Machine), I have the Admin folder configured as an application:

当我点击在IIS区/管理,身份验证下,我有匿名残疾人,和Windows身份验证启用。

And when I click on Areas/Admin in IIS, under Authentication, I have Anonymous disabled, and Windows Authentication Enabled.

然而,当我试图通过网站来访问此文件夹,它不提示我要我的域名用户名/密码。它只是加载了页面。

However, when I attempt to access this folder via the web site, it does not prompt me for my domain username/password. It just loads up the page.

如果我去www.website.com/Areas/Admin,它然后提示我输入用户名/密码。但我需要它使用AreaRegistration,并让它提示,当我去www.website.com/Admin。

If I go to www.website.com/Areas/Admin, it then prompts me for the username/password. But I need it to use the AreaRegistration, and have it prompt when I go to www.website.com/Admin.

我已经能够配置整个网站作为Windows身份验证,这就像一个魅力。

I've been able to configure an entire site as Windows Authentication, and that works like a charm.

任何思想导致我在正确的方向?或者,如果您需要了解更多信息,请给我留下了评论,我会很乐意给你我所能。

Any thought to lead me in the right direction? Or, if you need more information, please leave me a comment and I will be more than happy to give you what I can.

推荐答案

从做研究,我发现,使这项工作的唯一办法,就是要创建一个运行为主要站点下的应用程序中的第二个管理员网站。这样做,让我安装权限在该网站上。

From doing research, I found that the only way to make this work, is to create a 2nd "admin" site which runs as an application under the main site. Doing so, allowed me to setup permissions on that site.

这篇关于MVC3多个区域进行不同的验证方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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