Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2005, 02:27 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADODB.Stream Open via URL (Unspecified error)

Hi. I'm stumped.

Im getting an 'Unspecified error' on the line marked in red (see code below) on the server Microsoft 2000 Service Pack 4(IIS5, IE6) where on the server Microsoft 2000 Service Pack 2(IIS5, IE6) executes no problems.

Any ideas?

<%
var adModeRead = 1;
//
var adOpenStreamUnspecified = -1;
//
var adTypeBinary = 1;
var path = "http://servername/virtualpathtoddoc/docname.ext";
        try {
            var objStream = Server.CreateObject("ADODB.Stream");
            //This is where the error is invoked
objStream.Open("URL=" + path, adModeRead, adOpenStreamUnspecified);
            objStream.Type = adTypeBinary;
            Response.Write(objStream.Size);
        } catch(e) {
            Response.Write(e.description + " " + e);
        } finally {
            objStream.Close();
            objStream = null;
            Response.End;
        }
%>

 
Old December 5th, 2005, 05:30 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The server it doesn't work on has MDAC 2.8 SP1 and the server it works on has MDAC 2.7. It also seems to be an undocumented bug with MDAC 2.8 (i.e. no patches or hotfixes available).

I'm gonna try downgrading to 2.7 - hope it works.

 
Old December 7th, 2005, 01:30 AM
Registered User
 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok downgrading didn't work (for whatever reason). Beware once u upgrade your MDAC there's pretty much no going back.

I did however find a work around (see code below)

<%
 var strFilePath = "http://servername/virualpath_to_another_machine/pathtodoc/docname.ext";
 var remote = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0");
 remote.open("GET", strFilePath, false);
 remote.send();
 Response.BinaryWrite(remote.responseBody);
 Response.End;
%>
If you want the size, I did it this way

<%
 var remote = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0");
 remote.open("GET", strFilePath, false);
 remote.send();
 var Stream = Server.CreateObject("ADODB.Stream");
 Stream.Open();
 Stream.Type = 1 ;// adTypeBinary = 1
 Stream.Write(remote.responseBody);
 Stream.Position = 0;
 lngBytes = Stream.Size;
 s = (lngBytes / 1024);//.length;
 s = s.toFixed(0);
%>

Dont forget to close the stream and the remote and set them to null.

Hope this helps.:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP ADODB.Stream Open via URL (Unspecified error) blackadder_ba2 Javascript 0 December 5th, 2005 02:21 AM
read url file as array or text stream w_g_day Excel VBA 0 May 19th, 2005 05:49 AM
Problems with ADODB.Open zippo BOOK: Beginning ASP 3.0 1 April 22nd, 2005 05:16 AM
unspecified error Meterman Classic ASP Databases 1 July 13th, 2004 10:19 AM
Adodb.stream File could not be opened. irabba Javascript 6 July 6th, 2004 06:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.