Skip To Main Content | Home | Sitemap | Contact
Latest Visitors: United States's flagUnited States's flagUnited States's flagUnited States's flagNetherlands's flagUnited States's flagChina's flagSweden's flagUnited States's flagSerbia's flagChina's flagChina's flagUnited States's flagCanada's flagUnited States's flagUnited Kingdom's flagKorea  Republic of's flagUnited States's flagUnited States's flagChina's flagUnited Kingdom's flagUnited States's flagEurope's flagChina's flagSweden's flag
 

How can you generate a pseudo GUID in ASP?

This example returns a random unique ID not formatted as a GUID. It does not rely on the Windows internal GUID generator which would be considered more likely to adhere the GUID defined guidelines.  This function was obtained at freevbcode.com and there is no discussion or proof as to the randomness or potential number of unique identifiers.

What is a GUID? Excerpt from Wikipedia: "A globally unique identifier or GUID is a special type of identifier used in software applications to provide a reference number which is unique in any context (hence, "globally"), for example, in defining the internal reference for a type of access point in a software application, or for creating unique keys in a database. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4×1038) is so large that the probability of the same number being generated twice is extremely small."

GUIDs are useful in creating anti-CSRF tokens for web applications.  Generate a True GUID Using ASPGenerate A GUID Using PHP.


Pseudo GUID: XCRWAFWNNR3132010144650


From 'http://www.freevbcode.com/ShowCode.Asp?ID=2320
Function AlmostUniqueID()
    dim iCtr, sChar, sID
    Randomize 
    for iCtr = 1 to 10
        sChar = Chr(Int((90 - 65 + 1) * Rnd) + 65)
        sID = sID & sChar
    Next
    sID = sID & Month(Now) & Day(Now) & Year(Now) & Hour(Now) & Minute(Now) & Second(Now)
    AlmostUniqueID = sID
End Function

Dim guid;
guid = AlmostUniqueID()
  


This Weeks Most Popular Pages Newest Pages