如何在IIS 7.5上对多个MVC 4 Web应用程序执行单点登录 [英] How to do Single Sign On for multiple MVC 4 web applications on IIS 7.5

查看:141
本文介绍了如何在IIS 7.5上对多个MVC 4 Web应用程序执行单点登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS 7.5上部署了2个MVC 4应用程序.我想在所有这些上都取得一个统一的标志.我在两个应用程序中都有以下web.config设置-

I have 2 MVC 4 applications deployed on IIS 7.5. I would like to achieve a single sign on all of them. I have following web.config settings in both the applications -

  <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" enableCrossAppRedirects="true" path="/" name=".MVCAuthCookie" timeout="45"  defaultUrl="/" slidingExpiration="false" protection="All" cookieless="UseCookies" />
    </authentication>
<machineKey
      validationKey="C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE" 
      decryptionKey="8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F" 
      validation="SHA1" />
    <authorization>
      <deny users="?" />
    </authorization>

当我登录第一个应用程序并在另一个选项卡中浏览第二个应用程序时,它仍然带我进入第二个应用程序的登录页面.我可以在提琴手中看到,MVCAuthcookie确实与第二个应用程序的get请求一起传递了.

When I logged in in the first app and I browse second application in a separate tab, it still takes me to the login page for the second app. I can see in fiddler that the MVCAuthcookie is indeed getting passed with the get request for second application.

我在这里想念什么?

推荐答案

原来,我需要将机器密钥元素的兼容模式设置为"Framework20SP2",如此处所述-

Turns out that I need to set compatibility mode for machinekey element to "Framework20SP2" as stated here - http://msdn.microsoft.com/en-us/library/system.web.configuration.machinekeysection.compatibilitymode.aspx which resolved the issue.

这篇关于如何在IIS 7.5上对多个MVC 4 Web应用程序执行单点登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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