user2357824
user2357824

Reputation: 93

ASP.NET identity two sites, one database

I have two sites based on ASP.NET MVC 5. For authorization I use ASP.NET Identity. Now I want to use one database with user data. These authorizations have one site to fit another site.

If I connect the two sites into one database then the authorization on one site user automatically authorizes and on another site. So do not be.

How to solve this problem?

Upvotes: 3

Views: 226

Answers (2)

Ilya Chumakov
Ilya Chumakov

Reputation: 25019

Ensure you don't share the cookie (try to set cookie's name for each app):

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    CookieName = "WebApp1AuthCookie"
});

These links may help:

Overlap User Login in Two Projects with ASP.NET Identity

Asp.Net Identity and cookie names

Upvotes: 2

gpersell
gpersell

Reputation: 84

One solution is to encapsulate your identity and authorization logic in a web service or in another type of service that can be used by both sites.

Upvotes: 1

Related Questions