更新现有用户的ASP.NET中的个人资料 [英] Update an existing user's profile in ASP.NET

查看:155
本文介绍了更新现有用户的ASP.NET中的个人资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变现有的用户的配置文件,而无需为用户创造一个新的配置文件。例如:我有一个用户名 USR1 ,我想只改变他的年龄,我该怎么办

I want to change an existing user's profile without having to create a new profile for the user. For example: I have a user name Usr1 and I want to change only his age, how do I do that?

推荐答案

请参见文章的全部细节。请注意,在某些情况下(见我的另一个答案评论),不生成的ProfileCommon。

See this article for the full details. Be aware that in certain cases (see my comment to another answer), ProfileCommon is not generated.

在这种情况下,你需要恢复使用ProfileBase:

In this case you need to revert to using ProfileBase:

ProfileBase profile = context.Profile;
DateTime dob= profile.GetPropertyValue("dob") as DateTime;
...
profile.SetPropertyValue("dob",dob);

这篇关于更新现有用户的ASP.NET中的个人资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆