Like somuch.com on Facebook Share somuch.com on Facebook somuch.com on Twitter Reddit LinkedIn Pinterest
Newest Tips & Tricks...

Home :: Tips & Tricks :: Active Server Pages

Generate GUID Values in ASP

In ASP, you have a couple ways to create a GUID. One of our favorite ways was posted to the newsgroups a while back by Peter Watt. It uses the Scriptlet type library to generate the value, like this

<%
guid = server.createobject("scriptlet.typelib").guid
response.write guid
%>

As with all Windows GUID operations, this method uses the current system time to create the unique value. Of course, to take advantage of this technique, you'll need the Scrobj.dll installed on your server (available in the latest Scripting Engine downloads from the Microsoft MSDN site, msdn.microsoft.com/scripting).

Source: Mike D. Jones

Recommended Links...