Developer forum

Forum » CMS - Standard features » Adding values to Pageview

Adding values to Pageview

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a project where I need to use a bit more extensively the Impersonation.

In order to improve the performance and also ensure a more sticky impersonation, I need to access some properties from the user and also update some propeties on the user.

I was wondering if it's possible (and how) to add the values that I am interested, to Pageview in order to access them easily. I have to admit that my knowledge about the pageview is very limited. If there is a more efficient way to access properties from the user, I am opened to suggestions.

Secondly, I need to be able to add or update a value on a custom field on the User profile without having to rely on the Extranet Module. Is this possible using the API?

Thanks,

Adrian


Replies

 
Nicolai Pedersen
Reply

Hi Adrian

Pageview is a new instance per page view, hence the name. It has a named property called Value get_Value("name")/set_Value("name") in C#. You can use that to add whatever you feel like to the pageview instance - but only lives for one pageview.

You can also get hold of a user object with all its properties using Dynamicweb.Modules.UserManagement.User.Current(Modules.UserManagement.PagePermissionLevels.Frontend)

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the reply.

In this case I completely missunderstood the PageView concept.

What would be the best approach for add/edit values of a User field?

Thanks,

Adrian

 
Nicolai Pedersen
Reply

Hi Adrian

You just use the user instance from above and update properties on the user. If you want to save the values, save the user object.

If it is just something for this one user session, you could use session object.

BR Nicolai

 

You must be logged in to post in the forum