Accessing Session Using ASP.NET Web API

前端 未结 13 1135
谎友^
谎友^ 2020-11-22 04:32

I realize session and REST don\'t exactly go hand in hand but is it not possible to access session state using the new Web API? HttpContext.Current.Session is a

13条回答
  •  日久生厌
    2020-11-22 05:11

    To fix the issue:

    protected void Application_PostAuthorizeRequest()
    {
        System.Web.HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);
    }
    

    in Global.asax.cs

提交回复
热议问题