문제

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.

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top