tags:

views:

361

answers:

1

How can I share my asp.net session with wcf session .

Say I have a Session["UserId"] in my asp.net application . I want to access this inside the WCF Signature . I enabled aspNetCompatibilityEnabled="true" in Webconfig & [ServiceContract(SessionMode=SessionMode.Required)] in WCF. I don't want to pass this session as an argument . How can I achieve this?

+2  A: 

You can't share an ASP.NET Session with WCF instance since they are in different Application Domains and could well be on different machines.

Here's a good article on Instance Context Sharing which will get you some way with "persistence session" in WCF. Then it's a question of passing shared data over the wire (or by using a common resource/database etc)

Dead account