Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hey Greg, try some of these out...
https://www.epinova.no/en/blog/handling-episerver-users-and-roles-reference-list/
Hi Greg
If you are using ASP.Net Identity for authentication, you can get the UserId of a logged-in user like this.
// Inside a controller or view.
string userId = User.Identity.GetUserId();
// Anywhere else.
string userId = PrincipalInfo.CurrentPrincipal.Identity.GetUserId();
Mind you, this method reads the UserId from authentication cookie, not directly from database.
Hello, all I am trying to make a simple request to retrieve the UserID from the Users Table after they have registered the user.
I have read that there are calls on Commerce Server to get this info:
PrincipalInfo.CurrentPrincipal.GetContactId()
For user name and email:
var customerContact = PrincipalInfo.CurrentPrincipal.GetCustomerContact();
However I cannot find anything on the CMS side that will do the same thing. Any help would be appreciated.