API Questions on Kentico API.
Version 6.x > API > Track Custom Value within Kentico CMS Site View modes: 
User avatar
Member
Member
Jeff Bramwell - 10/26/2011 10:56:54 AM
   
Track Custom Value within Kentico CMS Site
I posted a similar question to this but wanted to start a new question so as to be more specific...

I am overriding the default authentication process so our (Kentico CMS) site can authenticate via a proprietary service. That service will return a "Customer ID" once the authentication has succeeded. I want to store that Customer ID somewhere within the context of the current user's session so it can be obtained at any point by a web page/part.

I thought I could simply attach it to the CMSContext.CurrentUser object somehow but I haven't been able to figure that one out.

Can someone please tell me how to accomplish this?

--- Thanks, Jeff

User avatar
Member
Member
kentico_michal - 10/30/2011 5:27:42 AM
   
RE:Track Custom Value within Kentico CMS Site
Hello,

The UserSettingsID field is ID of related record from CMS_UserSettings table. So, you should not override its value.

I would recommend you to add a custom field to CMS_User table using Site manager interface [Development -> System tables -> edit User table -> add a new attribute].

Then, you can access (set and get value) the new field using SetValue and TryGetValue of UserInfo class:

UserInfo.TryGetValue(string columnName, out object value)

UserInfo.SetValue(string columnName, object value)


Best regards,
Michal Legen

User avatar
Member
Member
Jeff Bramwell - 10/31/2011 10:25:13 AM
   
RE:Track Custom Value within Kentico CMS Site
Michal,

Thanks for your reply. That was exactly what I was looking for!

--- Thanks, Jeff