Does GetObject work with ASP?

Discussion in 'ASP General' started by Rich, Nov 11, 2003.

  1. Rich

    Rich Guest

    Hello,

    I have not been working with ASP for too long at this time
    and am not real familiar with a lot of things about ASP.
    I have searched for articles on the following question but
    not come up with any definite answers. I would like to
    know if it is possible to use GetObject in order to
    read/write data between an ASP and an activeX
    application. VBS supports GetObject, so I thought ASP
    might, but I have not had any luck. Interestingly I can
    use CreateObject with ASP but not GetObject. I
    experimented with a homemade ActiveX exe I slapped
    together with no luck - Can't create ActiveX object
    error. I even tried it with an Excel workbook. Also did
    not work. Before I assume you can't use GetObject with
    ASP I thought I would check if maybe it is a special
    syntax I need or GetObject isn't designed for ASP (Note: I
    am adding my apps to the ROT to get the GetObject
    functionality - which works fine from vbs). Any comments
    appreciated.

    Thanks,
    Rich
    Rich, Nov 11, 2003
    #1
    1. Advertising

  2. Rich

    Steven Burn Guest

    Look into FSO (FileSystemObject)

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)
    Rich <> wrote in message
    news:15c401c3a88e$0ee4bd80$...
    > Hello,
    >
    > I have not been working with ASP for too long at this time
    > and am not real familiar with a lot of things about ASP.
    > I have searched for articles on the following question but
    > not come up with any definite answers. I would like to
    > know if it is possible to use GetObject in order to
    > read/write data between an ASP and an activeX
    > application. VBS supports GetObject, so I thought ASP
    > might, but I have not had any luck. Interestingly I can
    > use CreateObject with ASP but not GetObject. I
    > experimented with a homemade ActiveX exe I slapped
    > together with no luck - Can't create ActiveX object
    > error. I even tried it with an Excel workbook. Also did
    > not work. Before I assume you can't use GetObject with
    > ASP I thought I would check if maybe it is a special
    > syntax I need or GetObject isn't designed for ASP (Note: I
    > am adding my apps to the ROT to get the GetObject
    > functionality - which works fine from vbs). Any comments
    > appreciated.
    >
    > Thanks,
    > Rich
    Steven Burn, Nov 11, 2003
    #2
    1. Advertising

  3. Rich

    Rich Guest

    Thanks for that suggestion. I think I have played around
    a little bit with FileSystemObject but was using the wrong
    syntax and lost hope. Finally got it to work:

    set fso = CreateObject("Scripting.FileSystemObject")
    Set info = fso.CreateTextFile("ActiveXasptestR.txt")
    info.WriteLine "testing"
    info.Close

    Just needed a little encouragement.

    Thanks again,
    Rich

    >-----Original Message-----
    >Look into FSO (FileSystemObject)
    >
    >--
    >
    >Regards
    >
    >Steven Burn
    >Ur I.T. Mate Group
    >www.it-mate.co.uk
    >
    >Keeping it FREE!
    >
    >Disclaimer:
    >I know I'm probably wrong, I just like taking part ;o)
    >Rich <> wrote in

    message
    >news:15c401c3a88e$0ee4bd80$...
    >> Hello,
    >>
    >> I have not been working with ASP for too long at this

    time
    >> and am not real familiar with a lot of things about ASP.
    >> I have searched for articles on the following question

    but
    >> not come up with any definite answers. I would like to
    >> know if it is possible to use GetObject in order to
    >> read/write data between an ASP and an activeX
    >> application. VBS supports GetObject, so I thought ASP
    >> might, but I have not had any luck. Interestingly I can
    >> use CreateObject with ASP but not GetObject. I
    >> experimented with a homemade ActiveX exe I slapped
    >> together with no luck - Can't create ActiveX object
    >> error. I even tried it with an Excel workbook. Also

    did
    >> not work. Before I assume you can't use GetObject with
    >> ASP I thought I would check if maybe it is a special
    >> syntax I need or GetObject isn't designed for ASP

    (Note: I
    >> am adding my apps to the ROT to get the GetObject
    >> functionality - which works fine from vbs). Any

    comments
    >> appreciated.
    >>
    >> Thanks,
    >> Rich

    >
    >
    >.
    >
    Rich, Nov 11, 2003
    #3
  4. Rich

    Steven Burn Guest

    hehe, no problem ;o)

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)
    Rich <> wrote in message
    news:04f401c3a89a$144a00d0$...
    > Thanks for that suggestion. I think I have played around
    > a little bit with FileSystemObject but was using the wrong
    > syntax and lost hope. Finally got it to work:
    >
    > set fso = CreateObject("Scripting.FileSystemObject")
    > Set info = fso.CreateTextFile("ActiveXasptestR.txt")
    > info.WriteLine "testing"
    > info.Close
    >
    > Just needed a little encouragement.
    >
    > Thanks again,
    > Rich
    >
    > >-----Original Message-----
    > >Look into FSO (FileSystemObject)
    > >
    > >--
    > >
    > >Regards
    > >
    > >Steven Burn
    > >Ur I.T. Mate Group
    > >www.it-mate.co.uk
    > >
    > >Keeping it FREE!
    > >
    > >Disclaimer:
    > >I know I'm probably wrong, I just like taking part ;o)
    > >Rich <> wrote in

    > message
    > >news:15c401c3a88e$0ee4bd80$...
    > >> Hello,
    > >>
    > >> I have not been working with ASP for too long at this

    > time
    > >> and am not real familiar with a lot of things about ASP.
    > >> I have searched for articles on the following question

    > but
    > >> not come up with any definite answers. I would like to
    > >> know if it is possible to use GetObject in order to
    > >> read/write data between an ASP and an activeX
    > >> application. VBS supports GetObject, so I thought ASP
    > >> might, but I have not had any luck. Interestingly I can
    > >> use CreateObject with ASP but not GetObject. I
    > >> experimented with a homemade ActiveX exe I slapped
    > >> together with no luck - Can't create ActiveX object
    > >> error. I even tried it with an Excel workbook. Also

    > did
    > >> not work. Before I assume you can't use GetObject with
    > >> ASP I thought I would check if maybe it is a special
    > >> syntax I need or GetObject isn't designed for ASP

    > (Note: I
    > >> am adding my apps to the ROT to get the GetObject
    > >> functionality - which works fine from vbs). Any

    > comments
    > >> appreciated.
    > >>
    > >> Thanks,
    > >> Rich

    > >
    > >
    > >.
    > >
    Steven Burn, Nov 11, 2003
    #4
  5. > info.Close
    set info = nothing
    set fso = nothing
    Aaron Bertrand [MVP], Nov 12, 2003
    #5
  6. Rich

    Rich Guest

    Thank you for pointing this out. Actually, I do set fso
    to nothing. While I'm at it, may I ask how or if you
    could use FileSystemObject to write/pass data to an
    ActiveX app? (VB6 activeX app). Like in MS Access I could
    make a reference to myApp (which would be running and
    visible) and do this:

    Dim x As New myApp.Class1
    x.letSomething = "test"
    set x = nothing

    where .letSomething is some Public Property Let... in
    Class1 and "test" would end up in a textbox on a form of
    myApp. Is it possible to use FileSystemObject to do
    something similar in ASP (or vbs for that matter? For vbs
    I added GetObject functionality to my activeX app by
    adding it to the Windows Running Object Table and hooking
    it, but GetObject not working with ASP this way - which is
    what this post is about). If I can do something like this
    with FileSystemObject, may I ask how this is done? sample
    syntax.

    Thanks,
    Rich

    >-----Original Message-----
    >> info.Close

    >set info = nothing
    >set fso = nothing
    >
    >
    >.
    >
    Rich, Nov 12, 2003
    #6
  7. Rich

    Jon Mundsack Guest

    "Aaron Bertrand [MVP]" <> wrote in message
    news:...
    > > info.Close

    > set info = nothing
    > set fso = nothing


    Doesn't ASP release its variables after it's done with the response? I
    mean, as long as you release resources (e.g., close open files, recordsets,
    connections, etc.), is there something about taking advantage of ASP's
    implicit cleanup that is somehow distasteful? Not trying to be
    argumentative, just really want to know. Thanks.
    Jon Mundsack, Nov 12, 2003
    #7
  8. Rich

    Bob Barrows Guest

    Jon Mundsack wrote:
    > "Aaron Bertrand [MVP]" <> wrote in message
    > news:...
    >>> info.Close

    >> set info = nothing
    >> set fso = nothing

    >
    > Doesn't ASP release its variables after it's done with the response?
    > I mean, as long as you release resources (e.g., close open files,
    > recordsets, connections, etc.), is there something about taking
    > advantage of ASP's implicit cleanup that is somehow distasteful? Not
    > trying to be argumentative, just really want to know. Thanks.


    There are situations when automatic cleanup cannot occur, especially with
    recordsets (and therefore connections as well). It pays to be explicit.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Nov 12, 2003
    #8
  9. Rich

    Jon Mundsack Guest

    "Bob Barrows" <> wrote in message
    news:#...
    > Jon Mundsack wrote:
    > > "Aaron Bertrand [MVP]" <> wrote in message
    > > news:...
    > >>> info.Close
    > >> set info = nothing
    > >> set fso = nothing

    > >
    > > Doesn't ASP release its variables after it's done with the response?
    > > I mean, as long as you release resources (e.g., close open files,
    > > recordsets, connections, etc.), is there something about taking
    > > advantage of ASP's implicit cleanup that is somehow distasteful? Not
    > > trying to be argumentative, just really want to know. Thanks.

    >
    > There are situations when automatic cleanup cannot occur, especially with
    > recordsets (and therefore connections as well). It pays to be explicit.


    Again, not being argumentative, but can you give me an example of a
    situation where letting a variable fall out of scope would have a different
    effect than setting it to Nothing? Granted, you've got to close recordsets
    and connections, etc., but it seems like you're saying ASP can hold a
    reference to an object that from all outward appearances has fallen out of
    scope. Is that correct? (The reason I'm so concerned is that I rely on ASP
    to release variables all the time, so naturally if it turns out this is bad
    I'll have to change my ways.)
    Jon Mundsack, Nov 12, 2003
    #9
  10. Rich

    Bob Barrows Guest

    Jon Mundsack wrote:
    > "Bob Barrows" <> wrote in message
    > news:#...
    >> Jon Mundsack wrote:
    >>> "Aaron Bertrand [MVP]" <> wrote in message
    >>> news:...
    >>>>> info.Close
    >>>> set info = nothing
    >>>> set fso = nothing
    >>>
    >>> Doesn't ASP release its variables after it's done with the response?
    >>> I mean, as long as you release resources (e.g., close open files,
    >>> recordsets, connections, etc.), is there something about taking
    >>> advantage of ASP's implicit cleanup that is somehow distasteful?
    >>> Not trying to be argumentative, just really want to know. Thanks.

    >>
    >> There are situations when automatic cleanup cannot occur, especially
    >> with recordsets (and therefore connections as well). It pays to be
    >> explicit.

    >
    > Again, not being argumentative, but can you give me an example of a
    > situation where letting a variable fall out of scope would have a
    > different effect than setting it to Nothing? Granted, you've got to
    > close recordsets and connections, etc., but it seems like you're
    > saying ASP can hold a reference to an object that from all outward
    > appearances has fallen out of scope. Is that correct? (The reason
    > I'm so concerned is that I rely on ASP to release variables all the
    > time, so naturally if it turns out this is bad I'll have to change my
    > ways.)


    It's been a while since I read about this so I don't remember the details
    but a recordset object can be in a state where it cannot be closed by going
    out of scope (for example, there may be an ongoing or pending Update
    operations). This leaves it in memory causing a memory leak which can
    eventually crash IIS if it happens enough times.

    It has been very well documented in these groups where people have had
    problems with IIS crashing every few days, which they have resolved by
    modify their code and explicitly closing and destroying their ADO objects.

    My simple rule is: If I open it, I close it. If I create it, I destroy it.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Nov 12, 2003
    #10
  11. > Again, not being argumentative, but can you give me an example of a
    > situation where letting a variable fall out of scope would have a

    different
    > effect than setting it to Nothing?


    Why should I set my objects to nothing?

    Well, for one, when you explicitly set it to nothing, it is released
    immediately (IIS 5.0 and later). If you don't bother, it will wait until
    the page goes out of scope. I'll leave it as an exercise to the reader to
    determine which option is more efficient.

    I believe one example of much more detrimental behavior: A recordset object
    that holds a pessimistic lock can tie up resources long after the page goes
    out of scope, if the transaction is neither committed nor rolled back. Not
    sure how trivial it is to reproduce and demonstrate this phenomenen.

    Why people *want* to be lazy and leave out destruction statements is beyond
    me. I've never trusted automatic garbage collection, and probably never
    will -- I follow Bob's simple rule to the letter. Just write the extra 20
    characters and be done with it.
    Aaron Bertrand - MVP, Nov 14, 2003
    #11
    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. ]-[aTc]-[

    Getobject C# Equevlent

    ]-[aTc]-[, Jul 16, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    11,221
    Craig Deelsnyder
    Jul 17, 2004
  2. Delia
    Replies:
    4
    Views:
    792
    Michael Borgwardt
    Nov 19, 2004
  3. LamSoft

    ASP.NET C# GetObject

    LamSoft, Jun 6, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    924
    LamSoft
    Jun 6, 2007
  4. pardesiya

    GetObject error in ASP.NET

    pardesiya, Jul 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    530
    pardesiya
    Jul 19, 2007
  5. Goh, Yong Kwang

    Win32::OLE->GetObject doesn't work on WinXP?

    Goh, Yong Kwang, Jun 17, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    293
    Thomas Kratz
    Jun 17, 2004
Loading...

Share This Page