Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How to support the ASP.NET session in WCF calls?

$
0
0

Hi there

The question is answered, probably, here:

https://blogs.msdn.microsoft.com/wenlong/2010/02/20/using-asp-net-sessions-from-wcf/

but that code is all around the OperationContext.Current, which is not NULL only for a given code example.

In my case the system creates all proxies automatically and all I do is calling things like:

LoginServiceReference.LoginClient wc = new LoginServiceReference.LoginClient();
LoginServiceReference.IDTWebUserDTO user = wc.DoLogin(model.Login, model.Password);

It works Ok, but as you may see, the LoginClient is created for me automatically. When calling wc.DoLogin there is no way to get into its context to obtain the OperationContext. For sure, I can modify the generated proxy, but next time the system will re-generate it. Bad approach.

For me the OperationContext.Current is always NULL here. How to get the ASP.NET session ID (as the blogger does in his InitialInvoke() method) and how to assign it (as in his Invoke2() method) ?

Maybe you can suggest other technics to maintain the ASP.NET session for WCF communication?

Thanks.


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>