/// <summary> /// Called by the MVC framework before the action method executes. /// </summary> /// <param name="filterContext">The filter context.</param> public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext == null) { throw new ArgumentNullException("filterContext"); } var principal = PrivilegePrincipalPermission.Current; if (principal == null) { return; } var identity = principal.Identity as WebUserIdentity; if (identity == null) { return; } var session = new ApplicationSession(); session.Create(filterContext.HttpContext, principal, identity); }