标签:
public void ConfigureAuth(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider() { OnApplyRedirect = ctx => { if (!IsApiRequest(ctx.Request)) { ctx.Response.Redirect(ctx.RedirectUri); } } } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); } private static bool IsApiRequest(IOwinRequest request) { string apiPath = VirtualPathUtility.ToAbsolute("~/api/"); return request.Uri.LocalPath.StartsWith(apiPath); }
asp.net mvc中包含webapi时,token失效产生302的解决方案
标签:
原文地址:http://www.cnblogs.com/tiger2soft/p/5884524.html