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(); } }