Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Components
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 5th, 2005, 02:27 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
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;
        }
%>

  #2 (permalink)  
Old December 5th, 2005, 05:30 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
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.

  #3 (permalink)  
Old December 7th, 2005, 01:30 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
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.:)

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:23 PM.


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