asp.net Domain / Subdomain Authentication not working correctly
<p>I have a w2k3 server which hosts 2 sites under iis, such that I have Mysite.com and foo.mysite.com</p>

<p>I am trying to use forms authentication and single sign on.</p>

<p>Both sites have the same machine key, and the same domain prefixed with a . in the web.configs.</p>

<p>The 2 issues I have are;</p>

<p>1) If I go to <a href="http://www.mysite.com/login.aspx" rel="nofollow">http://www.mysite.com/login.aspx</a>, and login, then navigate to the subdomain it redirects me back to the login page. </p>

<p>But if I go to <a href="http://mysite.com/login.aspx" rel="nofollow">http://mysite.com/login.aspx</a> and login, then navigate to the subdomain it works. so why is it seeing www.mysite.com and mysite.com as seperate domains and thus invalidating my authentication?</p>

<p>It is my understanding that adding domain=".mysite.com" would work for all sub sites under the domain.</p>

<p>2) If I change the subdomain login url to be mysite.com not www.mysite.com and hit the subdomain first, it redirects to the login form fine, but when I log in it does not redirect to the subdomain, rather it looks for the subdomain page on the main site. i.e. Browse to foo.mysite.com/bar.aspx, it redirects to the login page, and when logged in it now tries to show mysite.com/bar.aspx not the page I first requested.</p>

<p>Any help explaining and resolving these issues is most welcome!</p>

<p>Thanks</p>

<p>As an update to this. I found a workround to the redirect issue elsewhere on this site. Dont know why it doesnt work as I'd expect, but I can now cross that one off.</p>

<p>Secondly (on my test system anyway) programatically specifying the domain works with www. whereas using domain="" in teh config file does not.</p>
