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?