468,765 Members | 978 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

urgent help needed!!


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
Jul 19 '05 #1
7 2313
"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
Jul 19 '05 #2
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" <no*@moreply.com> wrote in message
news:uh****************@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

Jul 19 '05 #3
it sounds like she is running it client-side

"Catherine Jones" <no*@moreply.com> wrote in message
news:uh****************@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

Jul 19 '05 #4
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" <no*@moreply.com> wrote in message
news:uh****************@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

Jul 19 '05 #5
Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
"Catherine Jones" <no*@moreply.com> wrote in message
news:uh****************@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

Jul 19 '05 #6
"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
Jul 19 '05 #7
Many Many thanx to all four of you, for providing such
great and timely help.
Thanx once again.
"Catherine Jones" <no*@moreply.com> wrote in message
news:uh****************@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

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Random | last post: by
4 posts views Thread by XML newbie: Urgent pls help! | last post: by
55 posts views Thread by Steven Nagy | last post: by
7 posts views Thread by meenasamy | last post: by
3 posts views Thread by N. Spiker | last post: by
reply views Thread by Christopher | last post: by
2 posts views Thread by dragonball | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.