Beispiel #1
0
        public static void LogoutCurrentUser(String redirectUrl)
        {
            if (!CurrentUserName.IsNullOrEmpty())
            {
                HttpContext.Current.Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now;
                FormsAuthentication.SignOut();
            }

            if (!redirectUrl.IsNullOrEmpty())
            {
                HttpContext.Current.Response.Redirect(redirectUrl);
            }
            else
            {
                HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery);
            }
        }