Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with ADODB.Stream Read method failure

1,461 views
Skip to first unread message

Roger Johnson

unread,
Jan 17, 2001, 2:40:59 PM1/17/01
to
I have tried using the ADODB.Stream object and I am running into a problem.
When execution hits the "myfile.Read" line, I get an error message:

"ADODB.Stream error '800a0c93' - Operation is not allowed in this context"

Below is my ASP server-side VBScript.

Any help would be greatly appreciated!

Roger Johnson,
Cerious Software, Inc.

SCRIPT:
<%
Dim srcfile, myfile, extn, imgdata

Response.Buffer = TRUE
Response.Flush

srcfile = request.querystring("FILE")
set filesys = CreateObject("Scripting.FileSystemObject")
set myfile = Server.CreateObject("ADODB.Stream")

if (not srcfile="") and filesys.FileExists(srcfile) then
'''' srcfile = "file://" & Left(srcfile,1) & "." & Right(srcfile,
Len(srcfile)-2)
myfile.Open ''''
(srcfile,adModeShareDenyNone,adOpenStreamAsync,"roger","seeking")
myfile.LoadFromFile srcfile
imgdata = myfile.Read(adReadAll)
myfile.Close
extn = filesys.GetExtensionName(srcfile)
Response.Write("<META HTTP-EQUIV='Content-Type' CONTENT='image/" &
extn & "'>")
Response.Write("<META HTTP-EQUIV='Content-Length' CONTENT='" &
CStr(myfile.size) & "'>")
Response.BinaryWrite imgdata
else
Response.Write("<HTML>")
Response.Write("<HEAD>")
Response.Write("<META HTTP-EQUIV='Content-Type'
CONTENT='text/html'>")
Response.Write("</HEAD>")
Response.Write("<BODY>")
Response.Write("Image not available")
Response.Write("</BODY>")
Response.Write("</HTML>")
end if
Response.End
%>

Michael Harris

unread,
Jan 18, 2001, 2:51:11 PM1/18/01
to
--- You don't use both the Open method with arguments *and* the LoadFromFile method.
--- You use the file:// protocol with a true UNC path in the Open method, but not with LoadFromFile.
--- IIRC, Open supports only "http://server/site/folder/filename.ext" or
file://server/share/folder/filename.ext syntax. LoadFromFile supports drive letter or UNC syntax
(without the file:// protocol)
--- The account your page is running under needs access to the file (regardless of whether you use
Open or LoadFromFile.

It would be a lot easier for you to work out the details from a standalone script with hardcoded
file paths. Once you get the basic "plumbing" code working you can then plonk it into the ASP page
and deal with the ASP access issues.

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Roger Johnson" <rjoh...@cerious.com> wrote in message news:e0Z6D4LgAHA.1612@tkmsftngp03...

Roger Johnson

unread,
Jan 29, 2001, 2:50:40 PM1/29/01
to
Michael,
Thanks for the info. I have since got my VBSh*t err... I mean VBScript to
work :)
Thanks again for the response.

Regards,
Roger Johnson
Cerious Software, Inc.

"Michael Harris" <Please....@To.NewsGroup> wrote in message
news:eb06EgYgAHA.1228@tkmsftngp04...

0 new messages