I have two domains to point to the same server(same application) but when I switch the domain I lose the login session.
How to login a user automatically when transferred from one domain to another?

Is this the best solution:

Pedro Coelho
Any suggestion?
That seems to be the best process. I'll have a situation like that for a few days and I can do some tests of different tricks, but it looks standard.

Have you read this dicussion? I'm out of ideas besides any of those two.

I think there is alternative if both your domains are sub-domains belonging to the same domain.
Like domain1.company.com and domain2.company.com.
In this situation you can do a Set Cookie targeting for the "company.com". This way both your sites would be able to read the cookie and avoid all that logic with parameters.

João Rosado

Is different domains. I will opt for the first solution.

Thanks for the feedback

How do you do logout in one domain and on the other do it automatically?