How can I share .net (C#) based authenticated session between web forms and MVC2 applications?

后端 未结 4 1208
借酒劲吻你
借酒劲吻你 2020-12-15 11:20

We have a small application we built in our spare time using the latest mvc3 and Entity Framework .net libraries available at the time, and deployed it. The management liked

4条回答
  •  情书的邮戳
    2020-12-15 12:07

    Forms authentication uses cookies to track users. Cookies can only be shared between the same domain. So for example if you had app1.foo.com and app2.foo.com simply configure those two applications to share the same domain cookie. For example both web.config should share the same forms authentication configuration:

    
      
    
    

    You also must ensure that both application share the same machine keys because an authentication cookie emitted by app1 needs to be decrypted by app2 with the same keys.

提交回复
热议问题