1

I have legacy .net mvc application integrated with ServiceStack APIs, I need to get/set Session values from ServiceStack APIs in order to communicate with legacy system to ensure proper working. I explored multiple option available in ServiceStack doc/other material but looks like nothing is working in my case.

enabled session feature:

Plugins.Add(new SessionFeature());

tried to use direct:

HttpContext.Current.Session

alternate way:

var req = (HttpRequest)base.RequestContext.Get<IHttpRequest>().OriginalRequest;
var session = req.RequestContext.HttpContext.Session;

but none of them seems working.

reference

user3603110
  • 169
  • 1
  • 6

1 Answers1

0

ServiceStack Sessions is a completely independent implementation with no dependency or coupling to ASP.NET’s Sessions.

To enable access to ASP.NET’s sessions within ServiceStack requests you’ll need to decorate its IHttpHandler with the IRequiresSessionState interface as documented Enable ASP.NET Sessions docs.

mythz
  • 141,670
  • 29
  • 246
  • 390