Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > where is the cmscontext user object set View modes: 
User avatar
Member
Member
fan4u - 8/24/2011 5:34:53 PM
   
where is the cmscontext user object set
We are trying to store the cmscontext user variable called ( organization_guid ) in to a session & use the custom macro to retrieve the value from session .
There are scenarios where the organization_guid needs to change within the same login context. That is the reason we are storing the value in session & overriding the session
Variable.

We would like to know which part of code sets the Cmscontext user object , so that we can add code to save it to session as well when a user logs in.

Thanks in Advance,
Satish

User avatar
Member
Member
kentico_michal - 8/26/2011 10:04:08 AM
   
RE:where is the cmscontext user object set
Hello,

I would suggest using the Login1_LoggedIn handler of Logon form web part (~\CMSWebParts\Membership\Logon\LogonForm.ascx.cs). This event is fired after successful login.

However, the CMSContext.CurrentUser is not initialized so you will need to manually access the UserInfo object by using UserInfoProvider.GetFullUserInfo method and the username from Login control:

// Current username
string userName = Login1.UserName;
UserInfo user = UserInfoProvider.GetFullUserInfo(userName);


Best regards,
Michal Legen