public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext) { var cookie = actionContext.Request.Headers.GetCookies(Constants.CookieSessionName).FirstOrDefault(); var profile = userProfileService.UpdateVisitorProfile( cookieService.DecryptCookie(cookie != null ? cookie[Constants.CookieSessionName].Value : null), actionContext.Request.GetClientIpAddress(), actionContext.Request.RequestUri.PathAndQuery, actionContext.Request.GetQueryString("lang")); if (cookie == null) { actionContext.Response.SetCookie(Constants.CookieSessionName, cookieService.EncryptCookie(profile.ID), DateTime.Now.AddYears(100)); } base.OnActionExecuting(actionContext); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var cookie = Request.Cookies[Constants.CookieSessionName]; Profile = userProfileService.UpdateVisitorProfile( cookieService.DecryptCookie(cookie != null ? cookie.Value : null), Request.UserHostAddress, Request.Url.PathAndQuery, Request.QueryString["lang"]); if (cookie == null) { Response.SetCookie(new HttpCookie(Constants.CookieSessionName, cookieService.EncryptCookie(Profile.ID)) { Expires = DateTime.Now.AddYears(100) }); } base.OnActionExecuting(filterContext); }