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