asp net forms authentication cannot login on two application in same time on same server

1.7k views Asked by At

I created two ASP.NET Web Forms Application in which I use separate Form authentication with different machine keys . But when I login in one of them I am logout in other. Same thing happen on production server and on localhost.

1

There are 1 answers

1
Carson63000 On BEST ANSWER

If you haven't configured at least one of the two applications to use a non-default cookie name, they will both try to use the same cookie name ".ASPXAUTH", and if by "on the same server" you mean they are accessed using the same hostname, then logging into one will overwrite the cookie of the other.

Try overriding the cookie name in your Web.config, something like this:

<authentication mode="Forms">
  <forms loginUrl="login.aspx" name=".FOOASPXAUTH" />
</authentication>

And in the other application:

<authentication mode="Forms">
  <forms loginUrl="login.aspx" name=".BARASPXAUTH" />
</authentication>