惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 BLOG

博客园 - Sunny

开发人员一定要加入收藏夹的网站(转载) 我写的一个小程序 tabs研究 dotnetnuke( modules /tabs )权限研究 数据库知识2 数据库学习1 asp.net缓存、企业程序库缓存及格式化日期 - Sunny - 博客园 可爱的外甥女 怎样写自己的ConfigurationHandler(DOTNETNUKE 研究)? 编写upload程序 多国技术总结 远程教育系统总结 项目(多国技术) 总结 循环遍历一个控件方法 页面验证码程序(C#) string与stringbuilder flyweigth享元设计模式与委托总结 dotnetnuke 本地化技术杂谈 怎样获取获取GridView里面的label
dotnetnuke 里profile 的使用
Sunny · 2006-04-06 · via 博客园 - Sunny
 

怎样扩张用户资料信息?

userprofile类中增加属性,然后编译成dllcopybin目录中,在web.config中增加profile属性即可。

DataProvider.Instance.UpdateUser(objUser.UserID, objSecurity.InputFilter(objUser.Profile.FirstName, PortalSecurity.FilterFlag.NoScripting Or PortalSecurity.FilterFlag.NoMarkup), objSecurity.InputFilter(objUser.Profile.LastName, PortalSecurity.FilterFlag.NoScripting Or PortalSecurity.FilterFlag.NoMarkup), objUser.Membership.Email)

更新users表里面的数据。

 ' Created seperate method to save profile data. SaveProfileProperty(objUser.Membership.Username, objUser.Profile.ProfileProperties)

更新webConfig文件里设置的字段,

实现代码如下:

  Private Sub SaveProfileProperty(ByVal userName As String, ByVal propHash As Hashtable)

            Dim objProfile As AspNetProfile.ProfileBase

            Dim objSecurity As New PortalSecurity

            objProfile = AspNetProfile.ProfileBase.Create(userName, True)

            'Looping through each key in profile hashtable.

            'Each key is profile property name.

            For Each key As Object In propHash.Keys

                'checking if property's datatype is string.

                'if it is string then we do input filter on value.

                If AspNetProfile.ProfileBase.Properties(key.ToString()).PropertyType Is GetType(String) Then

                    'Checking if value is set or not? if value is set then do input filter

                    'otherwise assign Nullstring.

                    If propHash.ContainsKey(key) AndAlso Not propHash(key) Is Nothing Then

                        objProfile(key.ToString()) = objSecurity.InputFilter(propHash(key).ToString(), PortalSecurity.FilterFlag.NoScripting Or PortalSecurity.FilterFlag.NoMarkup)

                    Else

                        objProfile(key.ToString()) = Null.NullString

                    End If

                Else

                    objProfile(key.ToString()) = Null.SetNull(propHash(key), AspNetProfile.ProfileBase.Properties(key.ToString()).PropertyType)

                End If

            Next

            objProfile.Save()

        End Sub



       代码分析:

新建一个实例profilebase pb=profilebase.create(name,true)

hash表里面的keyvalue通过调用itemkey=value方法

放入pb hash表中

然后调用pbSave()保存hash表。

用户注册信息的最后一步是调用membership.updateuser(msuser)方法

这样注册用户信息已放入三个表中:

usersaspnet_membership,aspnet_profile