title: FormsAuthentication.SetAuthCookie not working in IE9 or Chrome
body: <p>Sorry if this has been covered, but I about to pull my hair out.
  My site is using forms authentication and works perfectly when I test on //localhost but when I publish to the web it does not work in IE9. I have followed all the steps outlined in tutorials but when using IE9 or Chrome FormsAuthentication.SetAuthCookie never creates the cookie. The kicker is when I use Firefox it works. Below is code from my web.config and my code behind in C#.</p>
  
  <p>Basically, I collect the username and password from the user and authenticate against my SQL Server with a stored proc. Then return a temporary web key that the site uses to interact with the user's profile. The web key is stored in the FormsAuthentication cookie as the identity which I can retrieve to valildate the user being logged in.</p>
  
  <p>Also, I know that the authentication cookie is never created because I have an asp:loginstatus control on the page that never changes.</p>
  
  <p>web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="Login.aspx" 
           protection="All"
           path="/" 
           slidingExpiration="true" 
           timeout="60"  
           cookieless="AutoDetect" /&gt;
   &lt;/authentication&gt;
   &lt;authorization&gt;
    &lt;deny users="?"/&gt;
    &lt;allow users= "*"/&gt;
   &lt;/authorization&gt;
  </code></pre>
  
  <p>in the code behind:</p>
  
  <pre><code>void LogUserIn(string UserEmail, string Pwd)
  {
      conn = new SqlConnection(connstr);
      sql = new SqlCommand("exec usp_AuthLogin @Email, @Pwd", conn);
      sql.Parameters.AddWithValue("@Email", UserEmail);
      sql.Parameters.AddWithValue("@Pwd", Pwd);
      try
      {
          conn.Open();
          reader = sql.ExecuteReader();
          while (reader.Read())
          {
              Result = reader["Result"].ToString();  // value of webkey
          }
      }
      catch (Exception ex)
      {
      }
      finally
      {
          conn.Close();
      }
      // if successful log in and create cookie
      if (Result != "Denied")
      {
          FormsAuthentication.SetAuthCookie(Result, true);  // set cookie with webkey from sql server
          LoggedIn = true;
      }
      else
      {
          LoggedIn = false;
      }
  }
  </code></pre>
  
  <p>Please help</p>