开发者

Different Providers, different websites, still think I'm logged in on the same website

开发者 https://www.devze.com 2022-12-23 15:32 出处:网络
I have two web applications in the same solution. They both use different membership/profile and role providers.

I have two web applications in the same solution. They both use different membership/profile and role providers. They are named differently.

When I run the solution, and visit one websit开发者_开发问答e, and login everything is fine. I then go to the other website, it thinks I am already logged in and the profile provider tries to load profile properties that do not exist.

How can I keep them separate, so when I try to log in on one site, it doesn't think I'm still logged in on the other.


Your login token is stored in a cookie, and if both websites are running under "localhost" then your browser is sending the cookie from the first site to the second. You can change the name of the cookie that ASP.NET uses for each site so that they're unique with the following addition to your web.config file:

<configuration>
  <system.web>
    <authentication mode="Forms">
      <forms name="UNIQUE-COOKIE-NAME" />
    </authentication>
  </system.web>
</configuration>

Just make sure each website uses a different cookie name and you should be good.

0

精彩评论

暂无评论...
验证码 换一张
取 消