private static void OutsideAuth() { var action = MessageAction.LoginSuccess; Func <int> funcLoginEvent = () => { return(CookiesManager.GetLoginEventId(action)); }; var cookie = string.Empty; try { cookie = SecurityContext.AuthenticateMe(Constants.OutsideUser.ID, funcLoginEvent); } catch (Exception) { throw; } if (HttpContext.Current != null) { CookiesManager.SetCookies(CookiesType.AuthKey, cookie); DbLoginEventsManager.ResetCache(); } else { SecurityContext.AuthenticateMe(cookie); } }