title: MVC AZURE WA AD Singout without ACS
body: <p>In my MVC web app, I was trying to use both internal authentication and Windows Azure Active Directory (Without ACS) as Identity providers.I could add this app to Azure applications so that users can be authenticated from azure. </p>
  
  <p>I Was able to login using both Azure and local users without ACS. </p>
  
  <p>My problem is that I am not able to logout Azure users from my web app. The local users get logged out by clicking logoff, but the problem is with the azure accounts. I have just used default simple MVC sample app to test these and made a few modification here and there but nothing major. </p>
  
  <pre><code>        [HttpPost]
     // [ValidateAntiForgeryToken]
      public ActionResult LogOff()
      {
          Session.Clear();
          Session.Abandon(); 
          WebSecurity.Logout();
          FormsAuthentication.SignOut();
          return RedirectToAction("Login", "Account");
      }
  </code></pre>
  
  <p>This is the code I used to log off. I also faced an issue with forgery token in my view. Adding @Html.AntiForgeryToken() did not help me. </p>
  
  <p>My actual Code was just -</p>
  
  <pre><code>      [HttpPost]
     // [ValidateAntiForgeryToken]
      public ActionResult LogOff()
      {
          WebSecurity.Logout();
          return RedirectToAction("Login", "Account");
      }
  </code></pre>
  
  <p>But based on a few suggestions I found in some blogs, I changed this to the former. </p>
  
  <p>How do I logout/signout azure users ? Will I be able to delete any cookies that will help me in this cause? </p>
  
  <p>When I click on Logoff, it returns the same page without actually logging me out. But when I use the internal accounts, the app lets me logout and returns to the login page. </p>
  
  <p>I used VS2012 and used the Identity and Access tool to connect it to Azure AD,  using WS-Federation (protocol) and Windows Identity Foundation (WIF) 4.5 (framework). </p>
  
  <p>thanks ! </p>