Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outputting a GUID in VBScript ignores all text after it

I'm creating a GUID for use in a Classic ASP application, by using TypeLib. However, even a simple test such as writing the GUID out to the screen is giving me problems - it prints the GUID but ignores everything after it (e.g. HTML tags, additional words, anything).

Here's the rudimentary code to test this:

Set typeLib = Server.CreateObject("Scriptlet.TypeLib")
myGuid = typeLib.Guid
Response.Write myGuid & " is the new GUID"
Set typeLib = Nothing

This will display something like {9DDB27D1-F034-41D7-BB88-D0D811DB91CE} and that's it; the rest of the text is ignored and isn't written out. However, if I hard-code that GUID value and reference it from a variable, the rest of the text appears just fine. I've tried explicit conversion to a String value before displaying, but it still happens.

like image 205
Wayne Molina Avatar asked Jan 05 '09 15:01

Wayne Molina


1 Answers

I seem to have solved my own problem.. it was adding something extra to the text, so I had to do:

myGuid = Left(myGuid, Len(myGuid)-2)

and it now outputs fine. Strange.

like image 50
Wayne Molina Avatar answered Oct 03 '22 18:10

Wayne Molina