Use profile in dotnetnuke

Source: Internet
Author: User
Tags dotnetnuke

How to expand user information?

InUSERPROFILEClass, and then compiledDLL,CopyToBinInWeb. configAddProfileAttribute.

 

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)

 

UpdateUsersData in the table.

 'Created seperate method to save profile data.Saveprofileproperty (objuser. Membership. username, objuser. profile. profileproperties)

UpdateWeb.ConfigFields set in the file,

ImplementationCodeAs follows:

Private SubSaveprofileproperty (ByvalUsernameAs String,ByvalProphashAsHashtable)

DimObjprofileAsAspnetprofile. profilebase

DimObjsecurityAs NewPortalsecurity

 

Objprofile = aspnetprofile. profilebase. Create (username,True)

 

'Looping through each key in profile hashtable.

'Each key is profile property name.

For EachKeyAs Object InProphash. Keys

'Checking if property's datatype is string.

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

 

IfAspnetprofile. profilebase. properties (key. tostring (). propertytypeIs GetType(String)Then

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

'Otherwise assign nullstring.

IfProphash. containskey (key)Andalso NotProphash (key)Is Nothing Then

Objprofile (key. tostring () = objsecurity. inputfilter (prophash (key). tostring (), portalsecurity. filterflag. noscriptingOrPortalsecurity. 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

Code Analysis:

Create an instanceProfilebase Pb = profilebase. Create (name, true)

SetHashTableKey,ValueBy callingItem(Key)= ValueMethod

PutPB hashTable

Then callPB.Save() SaveHashTable.

 

The last step of user registration information is to callMembership. updateuser (msuser)Method

In this way, the registered user information has been placed in three tables:

Users,Aspnet_membership, aspnet_profile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.