Looking for GenerateUUID for WebApps

I didn’t find it in the docs, but is there an easy cross-platform method for GenerateUUID? This is for use in a WebApp (Session), in case that matters.

Each WebSession has a unique ID you could use.
WebSession.Identifier

Once upon a time @Kem_Tekinay wrote a cross platform GUID function. I have an adjusted version that lives in a GUID module, so you can use it like this:

var s as String = GUID.Generate

Here is that module:
GUID.xojo_code - 5kb

This is cross platform for Mac, Windows, and Linux - so it will work for Web Apps.

Einhugur Util plugin also has a GenerateUUID(true) function that will work for Web Apps. MBS has UUIDMBS.UUID.ValueFormattedString(false).

3 Likes

Will these Identifiers persist after the Session ends and the browser is closed, like a Cookie?

The session identifiers will persist as long as the WebApplication.SessionTimeout property dictates.

OK, that makes sense, thank you.

@Tim_Parnell does it again! Thanks for posting that, sir!

12:11:48 : Window1.Button1.Pressed A06DD244-D282-4D1F-A794-F97632C964BD
12:11:49 : Window1.Button1.Pressed 2D16975A-F328-4A88-BF9C-6C3509B4209F
12:11:50 : Window1.Button1.Pressed 98F27E90-5858-47E0-8CE5-504443406D55
12:11:52 : Window1.Button1.Pressed 4CF5B094-3F48-46BD-AEF4-815BC07EF3ED
12:11:54 : Window1.Button1.Pressed B42D95CD-837B-43E9-9B9B-C9646BF9E8E4
12:11:55 : Window1.Button1.Pressed 07FB3068-7968-45E1-9E2E-3A8BB26CFFBE
12:12:01 : Window1.Button1.Pressed 6A6E863F-00FA-4AE9-BA63-4840E036F4B2
12:12:02 : Window1.Button1.Pressed CA08BE10-C40A-4668-9888-B2C5BBE56AA5
12:12:03 : Window1.Button1.Pressed 91FB7AA0-9C2A-4CE0-8BDE-54F9299A14B9
12:12:04 : Window1.Button1.Pressed 4F32FE88-0D20-48A9-BDE2-8FC0A16875A3
12:12:05 : Window1.Button1.Pressed 9A30573C-9C8A-42E1-9BB4-3A60A33BEAD4

I do plan on stuffing this into a Cookie, and matching this Token to one I stuff in the database, and using it for magical purposes on a User’s return visits.