在Global.acax中,添加下面方法

       //设置session可用
        public override void Init()
        {
            PostAuthenticateRequest += MvcApplication_PostAuthenticateRequest;
            base.Init();
        }

        void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e)
        {
            HttpContext.Current.SetSessionStateBehavior(
                SessionStateBehavior.Required);
        }



可以关注本人的公众号,多年经验的原创文章共享给大家。


C# WebApi 中设置Session可用

 

相关文章:

  • 2022-12-23
  • 2021-09-17
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-11-05
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案