Asp.net 如何在codebehind中更新dotnetnuke用户配置文件映像?

Asp.net 如何在codebehind中更新dotnetnuke用户配置文件映像?,asp.net,dotnetnuke,dotnetnuke-module,Asp.net,Dotnetnuke,Dotnetnuke Module,我正在构建自己的“用户配置文件”模块,在其中一个选项中,用户可以更改其默认的dnn配置文件图像。我在“代码隐藏”中执行此操作时遇到问题。我正在使用c 这就是我到目前为止所做的: UserInfo myDnnUser = this.UserInfo; myDnnUser.Profile.InitialiseProfile(PortalId); myDnnUser.Profile.SetProfileProperty("Photo", "new filename"); myDnnUser.Prof

我正在构建自己的
“用户配置文件”
模块,在其中一个选项中,用户可以更改其默认的
dnn
配置文件图像。我在“代码隐藏”中执行此操作时遇到问题。我正在使用
c

这就是我到目前为止所做的:

UserInfo myDnnUser = this.UserInfo;
myDnnUser.Profile.InitialiseProfile(PortalId);

myDnnUser.Profile.SetProfileProperty("Photo", "new filename");
myDnnUser.Profile.SetProfileProperty("PhotoURL", "new url");

ProfileController.UpdateUserProfile(myDnnUser);
但它不工作,当我查看dnn使用的“文件”表时,它仍然是相同的(旧)文件名


有什么想法吗?

涉及三个表:
UserProfile
ProfilePropertyDefinition
文件

UserProfile存储ProfilePropertyDefinitions的PropertyValue

“Photo”PropertyName的预期PropertyValue是对文件表的FileID引用,而不是文件名。在设置照片之前,您需要获取文件ID:

    var objFiles = new FileController();
    FileInfo objFile = objFiles.GetFile("filepath", PortalID);
    myDnnUser.Profile.Photo = objFile.FileId;
    ProfileController.UpdateUserProfile(myDnnUser);
PhotoURL是一个只读属性,用于检索UserProfile的Photo属性的url