0

I have a w2k3 server which hosts 2 sites under iis, such that I have Mysite.com and foo.mysite.com

I am trying to use forms authentication and single sign on.

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

The 2 issues I have are;

1) If I go to http://www.mysite.com/login.aspx, and login, then navigate to the subdomain it redirects me back to the login page.

But if I go to http://mysite.com/login.aspx 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?

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

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.

Any help explaining and resolving these issues is most welcome!

Thanks

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.

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

Matt
  • 1,596
  • 2
  • 18
  • 32

1 Answers1

0

Why specify the domain? Also, why not use config inheritance, this can work across app pools.

Trent
  • 2,122
  • 1
  • 24
  • 38
  • You lost me slightly. I need to specify the domain in the config file so that it works for subdomains. The config files work, the issues I am having are why it wont redirect back to subdomain if I hit that first on a successful login, and why putting www. in front of my domain causes .net to see this as a seperate auth cookie. – Matt Mar 04 '11 at 16:15
  • I see, I thought you were using subfolders for some reason. Have you seen this post? http://stackoverflow.com/questions/608120/forms-authentication-across-sub-domains – Trent Mar 04 '11 at 16:27
  • Yes that post was the one that made me try it programatically. I guess I just have to remember to not do anything too clever in teh config file in future :) – Matt Mar 04 '11 at 16:35
  • config inheritance would only apply if `foo` was a virtual application inside of `www`. – Chris Marisic Mar 04 '11 at 16:37