/// <summary> /// 行为执行事件 /// </summary> /// <param name="filterContext"></param> protected override void OnActionExecuting(ActionExecutingContext filterContext) { VisitorTerminal vt = WebExtention.GetVisitorTerminal(); if (vt.IsMobileTerminal) { //this.JumpMobileUrl(filterContext.RouteData, "");//跳转至移动网站 } base.OnActionExecuting(filterContext); }
/// <summary> /// 授权失败处理 /// </summary> /// <param name="actionContext"></param> /// <param name="vret">返回消息</param> private Task HandleUnauthorizedRequest(HttpActionContext actionContext, Result vret) { HttpResponseMessage response = new HttpResponseMessage(); Result res = new Result(vret.Message, vret.Success); res.Status = vret.Status; response.Content = new StringContent(JsonExtention.ToJsonString(res), Encoding.GetEncoding("UTF-8"), "application/json"); response.StatusCode = HttpStatusCode.OK; actionContext.Response = response; //授权失败,收集访问信息 VisitorTerminal vt = AL.Common.Extention.WebExtention.GetVisitorTerminal(); LogHelper.Info(vt);//存储 return(Task.FromResult <object>(null)); }
/// <summary> /// 收集信息 /// </summary> /// <param name="Request"></param> public void Collection() { VisitorTerminal vt = WebExtention.GetVisitorTerminal(); LogHelper.Info(vt);//存储 }