GUIDs in ASP

Here's a useful tidbit of ASP code to get a GUID (Globally Unique ID)…with thanks to my buddy Elton:

' Some useful variables
DIM TypeLib, UserGUID, guid

' Create the appropriate object
' Note that Scriptlet.TypeLib should be installed
' on any IIS machine
Set TypeLib = Server.CreateObject(“Scriptlet.TypeLib”)

' Grab a GUID
guid = TypeLib.Guid

' Extract the useful portion of the GUID
UserGUID = left(guid, len(guid)-2)

' Release the object
Set TypeLib = Nothing

' … from here, you can use the variable UserGUID
' as you see fit.

Eric Longman posted at 2004-4-12 Category: Geek Stuff

Leave a Reply

(Ctrl + Enter)