Last post Feb 27, 2015 09:45 AM by BrockAllen
Feb 25, 2015 02:57 PM|koohbor323|LINK
I have two websites www.site1.com and
www.site2.com. I implemented SSO by setting the same Machine key for the both websites. Everything is OK and works fine, But I cannot get the UserID and Email truly in both websites:
Suppose that user1 from the site1 logs in, because of implementing SSO the user would be authenticated in the site2 too. In this situation the following code works fine in site1:
MembershipUser muser = Membership.GetUser();
Label1.Text = muser.Email + "<br/>" + muser.ProviderUserKey.ToString() ;
But this code gets the error “object reference not set to an instance of…” in the site2.com
Each website has a separate database and both of them uses asp.net membership provider and form authentication.
So could you please tell me how can I get the UserId and User Email in the site2.com as I discussed?
Feb 27, 2015 01:18 AM|Michelle Ge - MSFT|LINK
You can try to add some hidden controls to store those user information. Then you can try to get those information from hidden controls.
There is a document about SSO, please refer to the link below:
Hope it's useful for you.
Feb 27, 2015 09:45 AM|BrockAllen|LINK
A shared cookie isn't really SSO. I think you'd want to consider a proper SSO solution, but that involves setting up a SSO server. Look into OpenID Connect as the modern protocol to support this. IdentityServer3 is an open source implementation done in .NET: