Passing session data between ASP.NET web applications

后端 未结 2 1604
温柔的废话
温柔的废话 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
    0 讨论(0)
  • 2021-02-09 13:34

    It is possible to share ASP.NET session between different applications. Obviously all of the applications sharing the same session state database would need to be on the same version of ASP.NET (of on a version where the session state databases are compatible). Also, all the sharing applications would need to stay coordinated on how information in session state is maintained. For example a session variable would need to maintain compatible information and meaning between the application.

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