Profiles是系统面向用户提供的灵活性的个体信息的容器,一个用户的Profile可以使以下一种或多种的集合:
(1) 简单的字符串或其他基础类型
(2) 一个序列化的实体
(3) 基础类型及序列化实体的Dictionary
保存个性化信息:
1
public static void SaveProfile(BaseForm taskForm)
2

{
3
// Collect profile information
4
if (_profile == null) _profile = new ProfileInfo();
5
_profile.FormColor = taskForm.FormColor;
6
_profile.TextColor = taskForm.TextColor;
7
8
// Save Profile Information
9
IProfileProvider profileProvider;
10
profileProvider = ProfileFactory.GetProfileProvider();
11
profileProvider.SetProfile(Thread.CurrentPrincipal.Identity, _profile);
12
}

2



3

4

5

6

7

8

9

10

11

12

加载个性化信息:
1
public static void LoadProfile(BaseForm taskForm)
2

{
3
// Lookup profile information
4
if (_profile == null)
5
{
6
IProfileProvider profileProvider;
7
profileProvider = ProfileFactory.GetProfileProvider();
8
_profile = (ProfileInfo) profileProvider.GetProfile(
9
Thread.CurrentPrincipal.Identity
10
);
11
}
12
13
// Apply profile
14
if (_profile == null) _profile = new ProfileInfo();
15
taskForm.FormColor = _profile.FormColor;
16
taskForm.TextColor = _profile.TextColor;
17
}

2



3

4

5



6

7

8

9

10

11

12

13

14

15

16

17

2.dnn模块中的人性化设置:选择此项允许用户自定义模块外观,例如最小化和 最大化。
3.使用中遇到
设置信息
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString, "Voted", True)
获取信息
DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString(), "Voted")
可直接获取用户个性化的信息设置.