Developer forum

Forum » Development » Getting current user id in Dynamicweb 8 through API

Getting current user id in Dynamicweb 8 through API

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Don´t ask why, but I have to make this work on a Dynamicweb 8 solution

I have this on Dynamicweb 9, and it´s working fine

Dynamicweb.Analytics.UserIdentity.GetCurrentIdentity();

But can´t find anything 'similar' on Dynamicweb 8. Anyone got a clue?

/Hans


Replies

 
Nicolai Pedersen
Reply

Same in DW 9. Just make a reference to Dynamicweb.Analytics.dll

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Hans,

I think you want to know how to get the current User in DW8, right? In that case, you can use Dynamicweb.Modules.UserManagement.User.GetCurrentUser(). That will give you the current user based on the current execution environment (frontend or backend).

EDIT: If you only want the user id, you can use the method GetCurrentUserID() instead. That'll give you the the ID for the user based on the environment.

- Jeppe

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Perfect Jeppe 👍🏻

 

You must be logged in to post in the forum