views:

13

answers:

1

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 website, 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.

+1  A: 

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.

Dean Harding
Thanks mate, that did the trick!
Mike