You need to generate a unique identification value to track a user.

A very common task that deals with number generation is creating an UUID. UUID stands for Universally Unique Identifier. A UUID is a 35-character string representation of a unique integer. This unique integer is generated from the ethernet 'MAC' address built into the computer, along with the current time (in 100ns increments). This assures that the identifier will be unique.

It is important to note that ColdFusion uses a slightly different format for its UUIDs. ColdFusion UUIDs can be broken into 4 parts such as: B54D60CD-DF98-4869-9C3910ABE33E5112, while other companies such as Microsoft use a 5 part format such as: 4CFB048C-A19E-44E8-83E8-B842A3D43AA3. If you are interested in working with 5 part UUIDs in ColdFusion, you can refer to for a ColdFusion UDF (User Defined Function) for creating MS Style UUIDs.

You create an UUID in ColdFusion by using the CreateUUID() function:

<cfset userUUID = createUUID()>

This question was written by Jeremy Petersen
It was last updated on January 13, 2006.




comments powered by Disqus