我正在尝试为驻留在同一域中的 2 个网站设置单点登录
例如
http://mydomain (包含表单例份验证登录页面的顶级站点)
http://mydomain/admin (单独开发的网站驻留在父网站内的虚拟应用程序中)
已经阅读了一些关于单点登录的文章
例如
http://www.codeproject.com/KB/aspnet/SingleSignon.aspx
http://msdn.microsoft.com/en-us/library/dd577079.aspx
他们似乎认为这只是在每个 web.config 中具有相同 machinekey 部分的一种情况,以便每个应用程序的 cookie 加密和解密都是相同的
我已经设置了这个,我从来没有在子网站(虚拟应用程序)中提示我输入凭据
我总是在父站点中收到提示。
除了拥有相同的机器 key ,我还尝试添加相同的 <authentication>
和 <authorisation>
元素
知道我可能会错过什么吗?
最佳答案
web.config 的表单部分也需要相同。
Quote from - Forms Authentication Across Applications
To configure forms authentication across applications, you set attributes of the forms and machineKey sections of the Web.config file to the same values for all applications that are participating in shared forms authentication.
The following example shows the Authentication section of a Web.config file. Unless otherwise noted, the name, protection, path, validationKey, validation, decryptionKey, and decryption attributes must be identical across all applications. Similarly, the encryption and validation key values and the encryption scheme and validation scheme used for authentication tickets (cookie data) must be the same. If the settings do not match, authentication tickets cannot be shared.
关于asp.net - 使用表单例份验证的单点登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2453677/