• mvc Web api 无法获取session



    using
    System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Optimization; using System.Web.Routing; using System.Web.SessionState; namespace SocialMasterDataPortal { public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { this.InitializeAll(); //GlobalConfiguration.Configure(WebApiConfig.Register); WebApiConfig.Register(GlobalConfiguration.Configuration); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); GlobalConfiguration.Configuration.EnsureInitialized(); Heart.Initilize(); } //用于在webapi中支持session,重载这个方法就好了 public override void Init() { this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required); base.Init(); } } }
  • 相关阅读:
    用户管理
    开机、重启、用户登录注销
    网络请求的封装
    Vuex
    Promise
    Vue Router(二)
    Vue Router(一)
    Vue CLI
    前端模块化-导入导出
    插槽
  • 原文地址:https://www.cnblogs.com/FlowLight/p/5275755.html
Copyright © 2020-2023  润新知