I am trying to store some value in session from Web API 2 although is is against REST basic principle. But session lost with each request. It is a web form + web API project.
Added below code in Global.asax.cs
protected void Application_PostAuthorizeRequest()
{
System.Web.HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
}
Adding session data in one controller as below.
HttpContext.Current.Session["ABC"] = "text";
With each request/api call, session lost.
I need to set the session in Web API and access it in Web Form.
Tried this answer, but getting error like "Error 2 Cannot implicitly convert type 'void' to 'System.EventHandler' "