Asp.net Identity SSO in multiple projects on localhost

1.9k views Asked by At

I have a Visual Studio solution with 3 websites. Each website is a sub-domain on the live server. The login website is using the new claim based Identity authentication with OAuth.

So:

Website A = Admin (admin.domain.com)

Website B = Identity Portal for logins (login.domain.com)

Website C = Normal visitor website (www.domain.com)

This work very well on the live server by specifying the authentication cookie on website B to be for sub-domains, ".domain.com".

My question is, if i run the project in Visual Studio, how can i login on website B and stay logged in over website A and C? (I can not set the cookie to localhost since they all use their own port e.g, localhost:2245.)

I also do not want to create separate login forms on website A and C just for Visual Studio debugging.

1

There are 1 answers

0
Eldarien On BEST ANSWER

Write your sites in hosts file (c:\Windows\System32\drivers\etc\hosts) Like this:

127.0.0.1     admin.domain.com
127.0.0.1     login.domain.com
127.0.0.1     www.domain.com

You can use any domain name (not real one). Then configure your IIS bindings as usual (all 3 names for one web site) and you will be able to open all these "virtual" sites in your browser, have different cookies, etc. You will need full IIS for this, not IIS express.