且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在父子Web应用程序之间共享身份验证

更新时间:2023-01-09 12:01:42

确保将domain属性设置为父域:

Make sure that the domain property is set to the parent domain:

<forms 
    loginUrl="~/Account/LogOn" 
    name=".ASPXFORMSAUTH"  
    domain="domain.com" 
    protection="All" 
    timeout="2880"
/>

还要确保为两个应用程序设置了相同的机器密钥:

Also make sure that you have set the same machine keys for both applications:

<machineKey validationKey="5C1E392DB9867A990FE0161B8BD07C1B165921DDAB21ADCC4C8F15D67EA2DECD7AEBB04409A411C69CB125EDEA3702B64DF17D47AD951461F444175BDF0277CF" decryptionKey="43CC900E97D496FC6C5C0C12FE005F9E846675C4BD45977BA5CEE852741ED3B6" validation="SHA1" decryption="AES" />

这将确保第一个应用程序加密的表单身份验证cookie可以被第二个应用程序解密.您可以使用以下网站生成强大的机器密钥.

This will ensure that a forms authentication cookie encrypted by the first application could be decrypted by the second. You could use the following website to generate strong machine keys.

(链接已删除.不再有效)

(Link removed. Is no longer valid)