urgent help needed!!

C

Catherine Jones

Hi all

we are getting active x component can not create object (Error No. 16) while
creating an instance of File System Object in ASP client side script. Could
you plz help us in solving this problem. We were working on opening a
selected text file at client site and inputing the content. I have pasted
the same code bellow of which plz find in order.

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub button1_onclick
dim fName,strline,i
dim objfs,objFile,str
fName=document.form1.file1.value

set objfs = CreateObject("Scripting.FileSystemObject")
set objFile=objfs.OpenTextFile(fName)
str=""
do while objFile.AtEndOfStream<>true
strline = objFile.ReadLine
if str="" then
str=strline
else
str=str & "," & strline
end if
loop
objFile.close
set objfs=nothing
document.form1.text1.value=str
End Sub

-->
</SCRIPT>

Now the file is pure html file and i have writen a client site script.
Irrespective of whether the client site the object present or not, if i open
the html file by double clicking onto it. I am getting the file read. The
same thing if i run it over IIS with a hyperlink onto the same machine, am
getting Active X Component can not create object. Where as in my browser
setting i have active x support enabled.
I was just amazed as if i run the script directly am getting the result and
when i do the same using IIS it was giving error.
So plz do help me in this regards.

Thanks a lot for your time.

Regards
 
R

Rob Meade

...
We were working on opening a
selected text file at client site and inputing the content.

I *believe* you'll find that the FileSystem object is only server side,
therefore you will not be able to use this to open the document on the
client.

In this scenario you would need to be able to send the file to the server
first (file upload), and then read it in using the FileSystem object
afterwards..

I may have not fully understood what you were trying to do - so my
appologies if so...

Regards

Rob
 
M

Michel Thiffault

The FileSystemObject is not available client-side (for obvious security
reasons).

Two possible solutions:
1 - use a form, ask the user to upload the file (<input type="file" ... >)
2- build a custom ActiveX control to do that (assuming that the user will
accept to execute it).
 
C

Chris Barber

Running the HTML page from local disk places it in the 'intranet' security
zone of IE as opposed to running it from an http:\\ protocol which places it
firmly in the 'internet' zone.
I think you'll find that on XP the access to the local FSO is also blocked
irrespective of where the html file is loaded from.
I had a requirement recently to do this for a browser control hosted in a VB
application (obviously FSO should be allowed in this case) and had to write
my own ActiveX control to install with the VB app marked as 'Safe For
Scripting' so that I could do things like saving XML files directly from the
HTML without getting security errors. This worked a treat but of course is
totally unacceptable for an environment where the user doesn't want to have
to install an ActiveX control just to see your HTML page.

You *can* do this in a normal IE environment but the user will have to
either accept the security warning (if loaded as a .hta cos it won't work at
all otherwise) or accept the downloading and installation of the ActiveX
control - mine is Authenticode signed by my company of course. In both
scenarios you are at the mercy of the users acceptance of the warnings.

Chris.


Hi all

we are getting active x component can not create object (Error No. 16) while
creating an instance of File System Object in ASP client side script. Could
you plz help us in solving this problem. We were working on opening a
selected text file at client site and inputing the content. I have pasted
the same code bellow of which plz find in order.

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub button1_onclick
dim fName,strline,i
dim objfs,objFile,str
fName=document.form1.file1.value

set objfs = CreateObject("Scripting.FileSystemObject")
set objFile=objfs.OpenTextFile(fName)
str=""
do while objFile.AtEndOfStream<>true
strline = objFile.ReadLine
if str="" then
str=strline
else
str=str & "," & strline
end if
loop
objFile.close
set objfs=nothing
document.form1.text1.value=str
End Sub

-->
</SCRIPT>

Now the file is pure html file and i have writen a client site script.
Irrespective of whether the client site the object present or not, if i open
the html file by double clicking onto it. I am getting the file read. The
same thing if i run it over IIS with a hyperlink onto the same machine, am
getting Active X Component can not create object. Where as in my browser
setting i have active x support enabled.
I was just amazed as if i run the script directly am getting the result and
when i do the same using IIS it was giving error.
So plz do help me in this regards.

Thanks a lot for your time.

Regards
 
C

Catherine Jones

Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
 
C

Catherine Jones

Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top