coldfusioncoldfusion-9membership-providerasp.net-profiles

ASP Membership Profile in ColdFusion


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.


Solution

  • I finally wrote my own CFC and can be downloaded from http://collabedit.com/7xmca

    There are 3 functions:

    1. PasswordEncrypt => This is one if the queries I had to deal with when Hashing the Password in CFM to match that of Membership.

    2. ProfileGet("UserId","PropertyName") => returns the value of the property name.

    3. 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.