【问题标题】:authentification asp.net MVC 4 intranet身份验证 asp.net MVC 4 内网
【发布时间】:2014-01-24 20:29:38
【问题描述】:

我正在尝试使用 IIS Express 构建我的第一个 ASP.NET MVC 4、Intranet 应用程序。但是当我使用这个配置运行默认项目时:

 <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Windows" />
    <authorization>
      <deny users="?" />
    </authorization>

Web 应用程序需要用户名和密码才能访问。请问我在哪里可以找到?我该如何配置?

提前感谢!

【问题讨论】:

标签: c# asp.net-mvc-4 intranet


【解决方案1】:

您可以使用以下配置来允许某些用户无需登录:

<authorization>
  <allow users="user1,user2,...,userN" />
  <deny users="*" />
</authorization>

其中 user1、user2 到 userN 是您想要真正登录的用户的名称(无需输入任何密码)。如果您希望所有用户自动登录,您应该遵循 Wiktor 的建议并阅读他在评论中粘贴的文章: http://www.wiktorzychla.com/2012/06/iis-75-integrated-security-with-no.html

【讨论】:

  • 你能解释一下那个配置吗?
  • @bejger:这绝对没有必要
  • @bejger:谢谢密码呢?
  • 如果用户被授予访问权限(通过 ),则他/她无需输入任何密码。如果您遵循 Wiktor 的建议,您也不需要任何密码 - 开箱即可授予匿名访问权限。
  • @bejger,这不起作用。使用这些设置,我输入了用户名 =“user1”,密码中没有任何内容并确认。我得到一个错误页面。
【解决方案2】:

由于您的身份验证模式是 Windows &lt;authentication mode="Windows" /&gt;,它应该针对服务器上的 Windows 用户帐户进行身份验证。

【讨论】:

    猜你喜欢
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 2010-09-24
    • 2013-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多