Comment se déconnecter de l'utilisateur dans OWIN ASP.NET MVC5

J'ai un standard AccountController classe de ASP.NET MVC5 projet.
Lorsque j'essaie de déconnecter l'utilisateur, je suis confronté à une erreur coz HttpContext est null. (Je veux dire ici HttpContext.GetOwinContext().L'authentification est null)

Donc je ne peux pas obtenir de la façon dont nous pouvons déconnexion de l'utilisateur de la fin de la session...

Dans mondiale.asax j'ai eu ce

protected void Session_Start(object sender, EventArgs e)
{
     Session.Timeout = 3; 
}

protected void Session_End(object sender, EventArgs e)
{
            try
            {
                 var accountController = new AccountController();
                 accountController.SignOut();
            }
            catch (Exception)
            {
            }
}

AccountController

public void SignOut()
{
      //Even if I do It does not help coz HttpContext is NULL
      _authnManager = HttpContext.GetOwinContext().Authentication;    

    AuthenticationManager.SignOut();


}

private IAuthenticationManager _authnManager;  //Add this private variable


public IAuthenticationManager AuthenticationManager //Modified this from private to public and add the setter
{
            get
            {
                if (_authnManager == null)
                    _authnManager = HttpContext.GetOwinContext().Authentication;
                return _authnManager;
            }
            set { _authnManager = value; }
}

De démarrage.Auth.cs a

 public void ConfigureAuth(IAppBuilder app)
        {
            //Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                ExpireTimeSpan = TimeSpan.FromMinutes(3),
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
}

source d'informationauteur Academy of Programmer