Developer forum

Forum » Development » Get details about current extranet user

Get details about current extranet user

Dmitrij Jazel
Reply
Hello DW guys,

Wanted to know how can you get the username of the current user logged to the extranet.
I found this piece of code here, similar thing I want to achieve:
Dim usr As Backend.User
usr = Session("DW_Admin_User")
Only thing I need is to get details on current extranet user.
This should be quite easy... :-)

Regards,
Dmitrij



 


 

Replies

 
Dmitriy Benyuk
Reply
Hi Dmitrij,

you can try this:
'Retrieves the current user for the current context.
' If context is Frontend and no user is logged in, Nothing is returned.
Dynamicweb.Modules.UserManagement.User.GetCurrentUser()

Regards,
Dmitrij

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

Or if you explicitly want to make sure you're getting the Frontend user, you can do:

 

using Dynamicweb.Modules.UserManagement;

public class UserClass
{
    public static User GetCurrentUser()
    {
        var user = User.get_Current(PagePermissionLevels.Frontend);
        return user;
    }
}

- Jeppe
Votes for this answer: 0
 
Dmitrij Jazel
Reply
Ahh sweet...
Thanks alot guys!

Cheers,
Dmitrij

 

You must be logged in to post in the forum