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

推荐订阅源

Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
B
Blog
L
LangChain Blog
Y
Y Combinator Blog
美团技术团队
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
量子位
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Check Point Blog
D
Docker
小众软件
小众软件
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
IT之家
IT之家

博客园 - 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