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

Re: urgent help needed!! by Rob

Rob
Thu Nov 20 07:26:09 CST 2003

"Catherine Jones" wrote...

> 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



Re: urgent help needed!! by Michel

Michel
Thu Nov 20 08:56:57 CST 2003

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).

"Catherine Jones" <not@moreply.com> wrote in message
news:uh%233CMzrDHA.3456@tk2msftngp13.phx.gbl...
>
> 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
>
>



Re: urgent help needed!! by Jeff

Jeff
Thu Nov 20 09:15:17 CST 2003

it sounds like she is running it client-side

"Catherine Jones" <not@moreply.com> wrote in message
news:uh%233CMzrDHA.3456@tk2msftngp13.phx.gbl...
>
> 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
>
>



Re: urgent help needed!! by Chris

Chris
Thu Nov 20 09:29:10 CST 2003

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.

"Catherine Jones" <not@moreply.com> wrote in message
news:uh%233CMzrDHA.3456@tk2msftngp13.phx.gbl...

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




Thanx Rob,Michel,Jeff,Chris by Catherine

Catherine
Mon Nov 24 04:56:30 CST 2003

Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
"Catherine Jones" <not@moreply.com> wrote in message
news:uh%233CMzrDHA.3456@tk2msftngp13.phx.gbl...
>
> 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
>
>



Re: Thanx Rob,Michel,Jeff,Chris by Rob

Rob
Mon Nov 24 07:43:46 CST 2003

"Catherine Jones" wrote ...

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

You're welcome :o)

Rob



Thanx Rob,Michel,Jeff,Chris by Catherine

Catherine
Mon Nov 24 04:56:30 CST 2003

Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
"Catherine Jones" <not@moreply.com> wrote in message
news:uh%233CMzrDHA.3456@tk2msftngp13.phx.gbl...
>
> 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
>
>