Question

I have two sites:

  • mydomain.com
  • sub.mydomain.com

When I use Chrome or Firefox, I can login independantly to each websites, even at the same time.

The problem is with Internet Explorer (I tested with 7, 8, 9, 10).

When I login to the parent domain site, when I try to login in the subdomain it seems to login, but comes back to the login page. All the login validation works well, if I enter a wrong password.

I don't want the login to be shared accross domains.

Here is an example of the web.config part for authentication, it is the same for both sites.

<authentication mode="Forms">
  <forms loginUrl="~/Login" timeout="2880" defaultUrl="/" />
</authentication>

The only way to have the login working for both sites, is in IE (in the dev toolbar) to select cache -> clear session cookies.

Also, I already googled alot about the subject and it's not a wrong url with underscores or timezone difference between the server and the client.

Was it helpful?

Solution

I found a clean way to handle this in the configuration. Having the domain defined AND the name for the authentication cookie provides the insurance that both can work independantly from each other.

<authentication mode="Forms">
      <forms loginUrl="~/Login" domain="sub.mydomain.com" name="subdomain-login"  />
</authentication>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top