Hi Naresh,
Session's (that stored the logged in status) are stored in a Cookie on the user's browsers. Because cookies are domain specific, the "logged in" session cookie for example.com is not passed to site1.com nor site2.com
Here's how i worked around it:
First, create a table that has a (Guid) Authorization, (string) UserName, (DateTime) EnterDate.
Next, create a "Site Switcher" Drop down webpart that shows the other websites that the user can switch to. It needs the below logic:
- On drop down change, create a new entry for the table with a new random guid, the username, and the current date.
- Redirect the user to the other website, passing the authorization guid in the Url (ex: site1.com?auth=abcde-feafead-feafe-aefe)
On the other website, create an "Auto login" webpart, that looks for the authorization guid from the URL. If it finds that Auth in the URL, it needs to do the following:
- When it receives the guid, it does a lookup on the table (by authorization GUID) that has an EnterDate within say 2 minutes.
- If it finds the record then login the user through Kentico's API, and delete the record.
It may be possible to programatically set the user's session cookie for another domain as well, but i've never tested this and it may not work for security reasons.