469,936 Members | 2,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

Does GetObject work with ASP?

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
Jul 19 '05 #1
10 4124
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 <an*******@discussions.microsoft.com> wrote in message
news:15****************************@phx.gbl...
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

Jul 19 '05 #2
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 <an*******@discussions.microsoft.com> wrote in messagenews:15****************************@phx.gbl...
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

.

Jul 19 '05 #3
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 <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
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 <an*******@discussions.microsoft.com> wrote in

message
news:15****************************@phx.gbl...
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

.

Jul 19 '05 #4
> info.Close
set info = nothing
set fso = nothing
Jul 19 '05 #5
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
.

Jul 19 '05 #6
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
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.

Jul 19 '05 #7
Jon Mundsack wrote:
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
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"
Jul 19 '05 #8
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:#E*************@TK2MSFTNGP11.phx.gbl...
Jon Mundsack wrote:
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
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.)

Jul 19 '05 #9
Jon Mundsack wrote:
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:#E*************@TK2MSFTNGP11.phx.gbl...
Jon Mundsack wrote:
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
> 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"
Jul 19 '05 #10
> 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.
Jul 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andrei | last post: by
18 posts views Thread by Daniel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.