Sharing session state between 2 ASP.NET applications using SQL Server

前端 未结 2 1943
长发绾君心
长发绾君心 2020-12-06 12:33

I\'m working on a site that has a requirement to share session between a cms application and an online store application on the same domain eg.

mydomain.com
         


        
相关标签:
2条回答
  • 2020-12-06 13:03

    Persist all session data on the SQL-server, using the session-ID as key. Then use a cookie containing the session-ID that points to .mydomain.com so it will be available on both sub-domains.

    This article at 15 seconds covers the subject and even shows a technique to share sessions across completely different domains.

    0 讨论(0)
  • 2020-12-06 13:19

    It appears the issue we were having was that the session cookie domain was being being set differently on the 2 applications. This meant that each application generated it's own sessionId.

    We added <httpCookies domain=".ourdomain.co.uk" /> to our web.config and that seems to have solved it. Thanks for hte help, hope this helps someone else in the future.

    0 讨论(0)
提交回复
热议问题