title: Forms Authentication SSO - Why does User.Identity.IsAuthenticated == false
body: <p>I'm trying to set up SSO on two separate IIS web sites (with a common domain) using Forms Authentication.  I'm using the common approach of setting the auth cookie to the common domain and using matching machine key to enable decryption.</p>
  
  <p><strong>This works with no issues on test sites that I created</strong>.  However, when trying to implement this in a legacy Web Forms site, I'm running into something that I don't understand.</p>
  
  <p>When I log into one site, the test code on the second site has the following results:</p>
  
  <pre><code>var cookie = FormsAuthentication.GetAuthCookie("username", false); // works
  var ft = FormsAuthentication.Decrypt(cookie.Value);       // returns correct info
  var isAuthentication = User.Identity.IsAuthenticated;              // false
  </code></pre>
  
  <p>As an added bonus, whenever I sign in one site the other gets signed out (happens both ways.)</p>
  
  <p>There must be something fundamental that I'm missing here.  </p>
  
  <p><strong>Why</strong> is <code>User.Identity.IsAuthenticated</code> set to <code>false</code>, even though the FormsAuthentication ticket seems to be decrypting with no issues?</p>
  
  <p>UPDATE:  as pointed out below - <code>FormsAuthentication.GetAuthCookie</code> is not a valid way to obtain the existing auth cookie.  Which brings me to this:  I can see the top domain cookie in the browser, but it doesn't show up in the request.  I suspect this is where the problem is occuring.</p>
  
  <p><strong>Solution:</strong> Both sites were not targeting the same version of .Net Framework as specified by the web.config:</p>
  
  <pre><code>&lt;httpRuntime targetFramework="4.5" /&gt;
  &lt;compilation debug="true" targetFramework="4.5" /&gt;
  </code></pre>
  
  <p><strong>Updating both sites to target the same framework fixed the problem.</strong></p>