Can I use progID with TypeLib instead of UUID?

Discussion in 'ASP General' started by Peter X, Apr 7, 2004.

  1. Peter X

    Peter X Guest

    Hi all,

    Quick question - in my Global.asa I'm using code like this:

    <!--METADATA TYPE="TypeLib" NAME="Microsoft Scripting Runtime"
    UUID="{420B2830-E718-11CF-893D-00A0C9054228}" VERSION="1.0"-->

    Whereas in Windows Scripting Host .WSF files, I can use this:

    <reference object="Scripting.FileSystemObject" />

    Since UUID's are rather unfriendly, is it possible to use the prodID
    with ASP instead?

    Any related comments appreciated - TIA!

    --
    Peter.
     
    Peter X, Apr 7, 2004
    #1
    1. Advertising

  2. Peter,

    You are including a type library ID (from what I know, always a GUID), and
    not a prog ID. This is because you are not creating any object, and hence
    have to include the unfriendly GUIDs :)

    However, you can use an OBJECT tag, to create a object that lives across the
    session or Application:

    <OBJECT RUNAT=Server SCOPE=Session ID=MyObj PROGID="My.Class">
    </OBJECT>

    And use the reference MyObj in all your pages. Just make sure that the
    object is safe-threaded -- call from one page does not block the call from
    another.

    I think this is a bad practice, since you can not guarantee the state of the
    object, the chances of thread-blocking is very high.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Peter X" <> wrote in message
    news:...
    > Hi all,
    >
    > Quick question - in my Global.asa I'm using code like this:
    >
    > <!--METADATA TYPE="TypeLib" NAME="Microsoft Scripting Runtime"
    > UUID="{420B2830-E718-11CF-893D-00A0C9054228}" VERSION="1.0"-->
    >
    > Whereas in Windows Scripting Host .WSF files, I can use this:
    >
    > <reference object="Scripting.FileSystemObject" />
    >
    > Since UUID's are rather unfriendly, is it possible to use the prodID
    > with ASP instead?
    >
    > Any related comments appreciated - TIA!
    >
    > --
    > Peter.
     
    Manohar Kamath [MVP], Apr 7, 2004
    #2
    1. Advertising

  3. Peter X

    Peter X Guest

    Manohar Kamath [MVP] wrote:
    > Peter,
    >
    > You are including a type library ID (from what I know, always a GUID), and
    > not a prog ID. This is because you are not creating any object, and hence
    > have to include the unfriendly GUIDs :)
    >


    But really I'm doing the same in ASP as I'm doing in Windows Scripting Host!

    Going on the documentation for the <reference> element, you can either
    use a GUID or a prodID... so once I'd read this, tried it, and found it
    worked, I though it would be nice to be able to do the same in ASP.

    Heres a link to the <reference> docs:

    http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/wsh/htm/wsEleReference.asp


    > However, you can use an OBJECT tag, to create a object that lives across the
    > session or Application:
    >
    > <OBJECT RUNAT=Server SCOPE=Session ID=MyObj PROGID="My.Class">
    > </OBJECT>
    >
    > And use the reference MyObj in all your pages. Just make sure that the
    > object is safe-threaded -- call from one page does not block the call from
    > another.
    >
    > I think this is a bad practice, since you can not guarantee the state of the
    > object, the chances of thread-blocking is very high.


    Mmmm.. I might avoid that! :)

    I can continue using GUID's with ASP, but like I say I was just using
    <reference> for the first time and though, "oh, thats nice".


    Anyay Manohar, thanks loads for the reply!!

    --
    best regards,

    Peter.
     
    Peter X, Apr 7, 2004
    #3
  4. Peter X

    Ray at Guest

    Yes, and I believe some would say that doing so is more efficient, as the
    ASP engine will use late binding to create your objects. Here's some sample
    code:

    <object progID="Scripting.Filesystemobject" id="oFSO"
    runat="server"></object>

    <%
    Set oFile = oFSO.OpenTextFile("C:\file.txt")
    Response.Write Server.HTMLEncode(oFile.ReadAll)
    oFile.Close : Set oFile = Nothing
    %>

    Ray at hotel


    "Peter X" <> wrote in message
    news:...
    > Hi all,
    >
    > Quick question - in my Global.asa I'm using code like this:
    >
    > <!--METADATA TYPE="TypeLib" NAME="Microsoft Scripting Runtime"
    > UUID="{420B2830-E718-11CF-893D-00A0C9054228}" VERSION="1.0"-->
    >
    > Whereas in Windows Scripting Host .WSF files, I can use this:
    >
    > <reference object="Scripting.FileSystemObject" />
    >
    > Since UUID's are rather unfriendly, is it possible to use the prodID
    > with ASP instead?
    >
    > Any related comments appreciated - TIA!
    >
    > --
    > Peter.
     
    Ray at, Apr 8, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    297
  2. Paul McGuire

    win32com typelib difficulty

    Paul McGuire, May 24, 2004, in forum: Python
    Replies:
    0
    Views:
    531
    Paul McGuire
    May 24, 2004
  3. Alexander Eisenhuth

    Howto access a enumeration in a COM TypeLib

    Alexander Eisenhuth, Jun 21, 2005, in forum: Python
    Replies:
    2
    Views:
    471
    Alexander Eisenhuth
    Jun 21, 2005
  4. ilocke
    Replies:
    2
    Views:
    455
    ilocke
    Jun 2, 2007
  5. Vince C.
    Replies:
    12
    Views:
    273
    Vince C.
    Jan 15, 2004
Loading...

Share This Page