简体   繁体   English

通过.NET客户为例共享ASP.NET应用程序和WCF web服务之间的会话数据

[英]Sharing session data between ASP.NET app and WCF Webservice through .NET clinet

I have situation, when user prepare some data in ASP.NET application, it save them in session (application does not need database in such case). 我有一种情况,当用户在ASP.NET应用程序中准备一些数据时,它将它们保存在会话中(在这种情况下,应用程序不需要数据库)。

To print data on clients label printer I have little .NET WPF application which is opened from the website with session ID parameter. 要在客户端标签打印机上打印数据,我有很少的.NET WPF应用程序,该应用程序是从带有会话ID参数的网站打开的。 So now I have running application on client, witch knows session ID. 所以现在我已经在客户端上运行了应用程序,女巫知道了会话ID。

This client should use WCF webservice to get prepared data from server (service because there is more data transfers between client and server). 该客户端应使用WCF Web服务从服务器(服务,因为客户端和服务器之间有更多的数据传输)获取准备好的数据。 I need to control, how many times data are printed, so data are destroyed on the server after they are fetched for the first time. 我需要控制打印数据的次数,以便在首次获取数据后在服务器上销毁数据。

Now my question: How can I connect the client/webservice to opened session on the server with prepared data? 现在我的问题是:如何使用准备好的数据将客户端/ Web服务连接到服务器上打开的会话? Webservice is part of the server application. Webservice是服务器应用程序的一部分。

Thank you for ideas. 谢谢你的想法。 F. F。

If you have the session id for an in-memory user session, you should be able to implement the service to require sessions: 如果您具有内存用户会话的会话ID,则应该能够实现该服务以要求会话:

MSDN example... MSDN示例...

and inject a cookie manufactured by your client including the session id (just like the asp.net app uses) as part of the wcf request. 并在WCF请求中注入由客户端制造的cookie,其中包括会话ID(就像asp.net应用程序使用的一样)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM