码迷,mamicode.com
首页 > Windows程序 > 详细

ASP.NET Web Api

时间:2016-11-24 11:22:06      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:article   ret   ase   context   设置   protect   tin   blog   添加内容   

1、参考资料

Routing in Asp.NET Web Api:

http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api

http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-and-action-selection

Return Json Format

http://www.cnblogs.com/jiguixin/p/3230645.html

向Web Api 传递参数

http://www.cnblogs.com/Juvy/p/3903974.html

http://www.tuicool.com/articles/fuIjeaf

http://www.cnblogs.com/smiler/p/3144018.html

Http Cookies in Asp.Net Web Api

http://www.asp.net/web-api/overview/advanced/http-cookies

2、Web Api开启Sessioin功能

Global.asax.cs添加内容

 

    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
        }
        /// <summary>
        /// 重写Init方法并设置会话行为类型
        /// </summary>
        public override void Init()
        {
            this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
            base.Init();
        }
    }

 

ASP.NET Web Api

标签:article   ret   ase   context   设置   protect   tin   blog   添加内容   

原文地址:http://www.cnblogs.com/mingjia/p/5462065.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!