I am trying to replicate the ASP Membership Profile functionality in ColdFusion. Basically I want to be able to get and save the property values.
To understand my basic need, I have the following:
table: aspnet_Profile
UserID | PropertyNames | PropertyValuesString |...| LastUpdatedDate
xyzxyz | FirstName:S:0:5:LastName:S:5:1: | SollyM |...| 2013-01-01 00:00:00.000
Now using ASP.net, using profile.GetPropertyValue("FirstName")
will return Solly
and profile.GetPropertyValue("LastName")
will return M
.
The interpretation of the PropertyNames is:
LastName => PropertyName
S => String
5 => Starting Position
1 => Length
To save the new LastName
you use profile.SetPropertyValue("LastName","de Mots")
and the table will be as below:
table: aspnet_Profile
UserID | PropertyNames | PropertyValuesString |...| LastUpdatedDate
xyzxyz | FirstName:S:0:5:LastName:S:5:7: | Sollyde Mots |...| 2013-01-02 00:00:00.000
How can I replicate this in ColdFusion?
I have been trying this for over 2 days.
I finally wrote my own CFC and can be downloaded from http://collabedit.com/7xmca
There are 3 functions:
PasswordEncrypt
=> This is one if the queries I had to deal with when Hashing the Password in CFM to match that of Membership.
ProfileGet("UserId","PropertyName")
=> returns the value of the property name.
ProfileSet("UserId","PropertyName","NewPropertyValue")
=> updates the PropertyName
with the NewPropertyValue
.Note that the ProfileGet
and ProfileSet
only deals with the PropertyValuesString
and not the PropertyValuesBinary
of the Profile. You can extend this to get that much.