title: Logout of MVC4 application
body: <p>I'm continuing someone else's development AND I don't know much about current practices for authentication in MVC applications.</p>
  
  <p>The only things that are set about authentication are in the application's IIS configuration:</p>
  
  <ul>
  <li>.NET Authrization Rules = Allow, All Users</li>
  </ul>
  
  <p>Authentication:</p>
  
  <ul>
  <li>Anonymous Authentication: Enabled</li>
  <li>ASP .NET Impersonation: Disabled</li>
  <li>Windows Authentication: Enabled</li>
  </ul>
  
  <p>With this configuration, <strong>on the server</strong>, the browser asks me for a login/password. I enter my network login.
  Then I can get identify the user with <code>Request.RequestContext.HttpContext.User.Identity...</code></p>
  
  <p><strong>On local computer</strong> where I login using the same login/password: no user is logged in the application (Request.RequestContext.HttpContext.User.Identity.Name == ""). If I disable Anonymous Authentication, the browser simply keeps re-asking for loginpassword infinitely.</p>
  
  <p>My first problem is that I would like to be able to log out on server.
  From scarse info I got here and there I have already tried:
  <code>FormsAuthentication.SignOut();</code> --> does nothing
  <code>WebMatrix.WebData.WebSecurity.Logout();</code> --> Exception, tries to access a database (I got this from one of the VS2012 templates but I didn't think it would apply to my context).
  <code>if(this.Request.RequestContext.HttpContext.Session != null)
                      this.Request.RequestContext.HttpContext.Session.Clear();</code> --> Session is null, so this does nothing.</p>
  
  <p><strong>So, how can I log out in order to relog as a different user ?</strong></p>
  
  <p>(I would also like to be able to identify the user on local computer, but  I think that should be asked in another topic.)</p>