要在webApi里面使用Session必须在Global.asax插入
public override void Init() { this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required); base.Init(); }
要在webApi里面使用Session必须在Global.asax插入
public override void Init() { this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required); base.Init(); }
转载于:https://www.cnblogs.com/Linyb/p/4528140.html