Serenity.WebSecurityHelper.LogOut C# (CSharp) Method

LogOut() public static method

Logs out to logged user.
public static LogOut ( ) : void
return void
        public static void LogOut()
        {
#if ASPNETCORE
            var httpContext = Dependency.Resolve<IHttpContextAccessor>().HttpContext;
            httpContext.Authentication.SignOutAsync("CookieAuthenticationScheme").Wait();
#else
            HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName);
            // Setting up a cookie which has expired, Enforce client to delete this cookie.
            authCookie.Expires = DateTime.Now.AddYears(-30);
            //authCookie.Path = UrlHelper.GetApplicationRootPath();

            // bu path /site olmalı, /site/ olduğunda eğer http://sunucu/site yazılırsa path cookie bu yola uygulanmıyor, sürekli login gerekiyor!
            authCookie.Path = HttpContext.Current.Request.ApplicationPath;
            HttpContext.Current.Response.Cookies.Add(authCookie);
            //FormsAuthentication.SignOut();
#endif
        }