Create a guid in ASP

Source: Internet
Author: User

Code As follows:
JScript

Copy code The Code is as follows: function generateguid (){
VaR typelib = new activexobject ("scriptlet. typelib ");
Return (typelib. guid );
}

VBScript Copy codeThe Code is 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, the VBScript code needs to be slightly modified, namely:

Set typelib = server. Createobject ("scriptlet. typelib ")

To:

Set typelib = Createobject ("scriptlet. typelib ")

However, when the client uses ActiveX, the default security settings of IE will prompt whether ActiveX is allowed, so it is not recommended.
This can be done on the ASP server.
ASP (using vbs)Copy codeThe Code is as follows: function GUID ()
Dim objtypelib
Set objtypelib = Createobject ("scriptlet. typelib ")
Guid = left (CSTR (objtypelib. guid), 38)
Set objtypelib = nothing
End Function

The following code creates a guid for ASP (using JScript) on the server:Copy codeThe Code is 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.