Web Api2中使用Session

要在webApi里面使用Session必须在Global.asax插入

 

       public override void Init()
        {
            this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
            base.Init();
        }

 

posted @ 2015-05-25 16:09  Tauren  阅读(254)  评论(0编辑  收藏  举报