Passing session data between ASP.NET web applications

后端 未结 2 1679
温柔的废话
温柔的废话 2021-02-09 13:07

I\'m trying to help a friend - they have a pretty big web application (ASP.NET 4.0, Visual Basic) that has a number of subfolders that all act as quasi sub-applications (but the

2条回答
  •  没有蜡笔的小新
    2021-02-09 13:15

    Eventually I found the solution to this problem and I'm leaving it here as reference to others:

    StateServer uses a windows service (ASP.NET State Service) which handles the sessions in memory. This uses the MachineKey, AppDomainAppID as well as the SessionID to uniquely identify an application.

    • Set the same MachineKey in web.config to be the same for all applications under the site.
    • Add code in Global.asax Init() to set AppDomainAppID to be the same for all applications.
    • Implement ISessionIDManager and return custom Session ID to be re-used in the sub-applications.

    The following links provided the information to the actual implementation I did:

    • Sharing session state over multiple applications
    • Maintain the same session ID over multiple applications using state server
    • Sharing sessions over applications

提交回复
热议问题