ASP.NET Web应用程序之间传递会话数据 [英] Passing session data between ASP.NET web applications

查看:125
本文介绍了ASP.NET Web应用程序之间传递会话数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想帮朋友 - 他们有一个pretty大的Web应用程序(ASP.NET 4.0,Visual Basic)中有一些子文件夹,所有的行为准子应用(但他们的刚子文件夹的主要应用)。这个应用程序将因为其目前的形式被分割成多个独立的Web应用程序很难维持和发展任何进一步的。

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 they're just subfolders of the main application). This application will be split up into multiple independent web application because in its current form it's hard to maintain and develop any further.

问题是,目前的整体应用程序使用一个号码之类的用户信息,会话变量(登录后等),我不知道是否有安全地分享未来多个Web应用程序之间的这种信息的简单方法(这将显然有独立的会话)。会话状态存储在SQL Server。当前Web应用程序的用户都是外部用户,而不是所有的用户都可以访问所有的子应用程序。

The problem is that the current monolithic application uses a number of session variables for things like user information (after logon, etc.) I wonder if there's an easy way to share this information securely among the future multiple web applications (which will obviously have independent sessions). Session state is stored in SQL Server. The users of the current web application are all external users and not all users have access to all "sub-applications".

我在寻找一些建议有关这两个东西:

I'm looking for some advice about these two things:

1。
我已经做了一些搜索,发现单点登录 - 这似乎解决了这些应用程序的认证问题,但我不熟悉它,我不理解为什么当会话过期的认证信息被删除,因为不同的Web应用程序将有不同的会话。是有可能在一次会议在其中的一个过期的所有Web应用程序注销用户?

1. I already did some searching and found single-sign-on - this seems to solve the problem of authentication across these applications but I'm unfamiliar with it and I don't understand how the authentication information is deleted if the "session" expires, since the different web applications will have different sessions. Is is possible to log out a user from all web applications once the session expires in one of them?

2。
我怀疑(但不知道)有可能是的,可能需要拆分后要共享的认证信息顶部其他一些会话数据。什么是做到这一点的最好方法(同样安全可靠地)?

2. I suspect (but not sure) that there may be some other session data on top of the authentication information that may need to be shared after the split. What would be the best way to do this (again reliably and securely)?

我发现这篇文章传递的ID (于将持有该数据库记录共享数据),不知道这是很好的。

I found this article about passing IDs (to database records that would hold the shared data) and wonder if it's good.

所有的建议是AP preciated。

All advice would be appreciated.

PS:我发现了一些线程这里SO关于这一点,但我不相信任何人回答这些具体的问题。我发现最有用的是这一个:

PS: I found a number of threads here on SO about this but I don't believe any of them answer these specific questions. The most helpful I found was this one:

<一个href=\"http://stackoverflow.com/questions/616046/passing-session-data-between-asp-net-applications\">Sharing ASP.NET应用程序之间的数据

推荐答案

我终于找到了解决这个问题,我在这里把它当作参考他人:

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

的StateServer使用Windows服务(ASP.NET状态服务),其中处理会议在内存中。此使用的machineKey,AppDomainAppID以及SessionID的唯一标识的应用程序。

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.


  • 设置在web.config中相同的machineKey成为该网站下的所有应用程序相同的。

  • 添加code在Global.asax中的init()来设置AppDomainAppID是所有应用程序相同的。

  • 实施ISessionIDManager并返回定制会话ID在子应用程序被重新使用。

以下链接提供的信息来实际执行我所做的:

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

这篇关于ASP.NET Web应用程序之间传递会话数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆