/// <summary> /// Ends the current impersonation session. /// </summary> public static void End() { if (!IsImpersonated()) { return; } CookieProperty.Remove <ILanguage>(); var admin = Impersonator; Database.Update(admin, o => o.ImpersonationToken = null); admin.LogOn(); var returnUrl = OriginalUrl; OriginalUrl = null; ImpersonationToken = null; if (!Context.Request.IsAjaxCall()) { Context.Response.Redirect(returnUrl); } }