3

I have been trying to configure my Web API 2, that uses the Startup class to configure the API (OWIN Self-Hosting), for it to support the use of the Session object. I am aware that a REST application should be statless, but I need to use the session anyway.

I have tried this solution, but it won't work.

I have also looked at multiple blog posts and articles that suggest using a custom RouteHandler that overrides the GetHttpHandler method to use a controller that implements IRequiresSessionState (as explained here). But my startup class uses HttpRouteCollection, and my method MapHttpRoute does not support the property RouteHandler.

I have tried moving the route configuration from my Startup class to the Application_Start in a Global.asax I have added, but it is not working either (the requests are not reaching the controllers).

Any suggestion would be much appreciated!

Thank you

Community
  • 1
  • 1
Nicole
  • 1,356
  • 3
  • 21
  • 41

0 Answers0