Web API Session-Enabled Routes
Sitecore pipeline processor and extensions to the HttpRouteCollection to enable session in Web API 2.
Package
GitHub
Web API Session-Enabled Routes
This project contains a Sitecore pipeline processor and extensions to the HttpRouteCollection
to enable session in Web API 2.
Usage
- Add Sitecore's NuGet repository added to Visual Studio.
- Build the solution and add
WebApiEnableSessionHandler.dllas a reference to your Web API 2 projects. - Deploy
WebApiEnableSessionHandler.configintoApp_Config\Include\zzz.WebApiEnableSessionHandler. Ensure thatWebApiEnableSessionHandler.Pipelines.InitializeSessionEnabledRouteHandlersis one of the last processors in theinitializepipeline. - Use
config.Routes.AddHttpSessionRoute()in your Web API initialization to register session-enabled routes. SetreadOnlySessiontofalsefor routes that only need read access to session; set it totruefor routes that need read and write access to session.