Create guid_ application Tips in ASP

Source: Internet
Author: User
The code is as follows:
JScript

Copy Code code as follows:

function Generateguid () {
var TypeLib = new ActiveXObject ("Scriptlet.Typelib");
return (TYPELIB.GUID);
}

VBScript
Copy Code code as follows:

Function Generateguid ()
Dim TypeLib
Set TypeLib = Server.CreateObject ("Scriptlet.Typelib")
Generateguid = Typelib.guid
End Function

If you want to use it on the client side, the code for VBScript needs to be slightly modified:

Set TypeLib = Server.CreateObject ("Scriptlet.Typelib")

Modified to:

Set TypeLib = CreateObject ("Scriptlet.Typelib")

However, when the client uses ActiveX, the IE default security setting prompts for the use of ActiveX, so it is not recommended.
If this is an ASP server, you can
ASP (using VBS)
Copy Code code as follows:

Function GUID ()
Dim Objtypelib
Set Objtypelib = CreateObject ("Scriptlet.Typelib")
GUID = Left (CStr (Objtypelib.guid), 38)
Set Objtypelib = Nothing
End Function


The code for ASP (using JScript) to create GUIDs on the server side is as follows:
Copy Code code as follows:

function GUID () {
return new ActiveXObject ("Scriptlet.Typelib"). Guid.tostring (). substring (0,38);
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.