Re: IIS 6 Problems with ADODB.Stream

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Greg (greg_platt_at_hotmail.com)
Date: 07/21/04


Date: Wed, 21 Jul 2004 14:55:31 +1000

I've setup two links so you can try yourself and see if you get the same
result

The first is link from the webpage
http://www.powerfront.net/secure/downloadfile.asp?fileid=1001959&referid=1001960

cut and paste the following into your web browser (i've added pass=1 to
bypass the html weblink response)
http://www.powerfront.net/secure/downloadfile.asp?fileid=1001959&referid=1001960&pass=1

"Greg" <greg_platt@hotmail.com> wrote in message
news:ekJaTvtbEHA.644@tk2msftngp13.phx.gbl...
> Thats what i thought, but why would it work on my IIS5 server and not
IIS6?
>
> Example:
>
> Correct IE pop would be
>
> Filename : myfile.pdf
> File type : Abobe Acrobat Document
> From : www.myserver.com
>
> Would you like to save the file.....etc
>
>
> If i cut and paste the link into IE and click enter:
>
> Filename: downloadfile.asp
> File type :
> From : www.myserver.com
> Message: This type of file could harm your computer if it contains
malicious
> code.
>
> Would you like to save the file.....etc
>
> For some reason it doesnt get the name of the file and find a content type
> although it does allow me to save the file.
>
> A link from outlook opens IE and the popup displays
>
> Filename: www.myserver.com/downloadfile.asp?fileid=1001959
> File type :
> From : www.myserver.com
>
> When i click save the filename is "downloadfile.asp" and i have to rename
> it.
>
> I just dont understand why the filename is not sent in the
> content-disposition correctly.
> Why would it work on ISS5 and not IIS6?
>
>
>
>
> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> news:OmoSAdtbEHA.2660@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > a) Why do you think this is an IIS issue? How can IIS tell the
difference
> > between someone clicking a link in a webpage -vs- someone typing the
> address
> > directly into their address bar? As far as IIS is concerned, it's just a
> > HTTP request
> >
> > b) You say the "file download dialogue is not triggered correctly" -
what
> > happens instead?
> >
> > Cheers
> > Ken
> >
> > "Greg" <greg_platt@hotmail.com> wrote in message
> > news:uAVFfEtbEHA.1004@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > >
> > > I have an ASP script that initiates a ADODB.Stream like below
> > >
> > >
> > > first bit gets filename from the database
> > > strAbsFile = getfilefromDB(request.querystring("fileid"))
> > >
> > > '-- create FSO object to check if file exists and get properties
> > > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
> > > '-- check to see if the file exists
> > > If objFSO.FileExists(strAbsFile) Then
> > > Set objFile = objFSO.GetFile(strAbsFile)
> > > Response.Buffer=True
> > > Response.Clear
> > > '-- the filename you give it will be the one that is shown
> > > ' to the users by default when they save
> > > Response.AddHeader "Content-Disposition", "attachment;
filename="
> &
> > > objFile.Name
> > > Response.AddHeader "Content-Length", objFile.Size
> > > Response.ContentType = "application/octet-stream"
> > > Set objStream = Server.CreateObject("ADODB.Stream")
> > > objStream.Open
> > > '-- set as binary
> > > objStream.Type = 1
> > > Response.CharSet = "UTF-8"
> > > '-- load into the stream the file
> > > objStream.LoadFromFile(strAbsFile)
> > > '-- send the stream in the response
> > > Response.BinaryWrite(objStream.Read)
> > > objStream.Close
> > >
> > > This works fine when i trigger this script to download the file from a
> > link
> > > in a webpage. However, when i trigger this script from a link in an
> email
> > or
> > > if i cut and paste the link into the browser and hit enter, the popup
> file
> > > download is not triggered correctly. It seems filename and content
type
> > are
> > > not registered correctly.
> > >
> > > A typical link would be
> > > http://www.myserver.com/downloadfile.asp?fileid=1003452
> > >
> > > I have the same application running on IIS5 and it works fine so i'm
> > > guessing its either IIS6 or Windows 2003 server issue.
> > >
> > > Can anyone explain this,
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: IIS 6 Problems with ADODB.Stream
    ... but why would it work on my IIS5 server and not IIS6? ... File type: Abobe Acrobat Document ... Filename: downloadfile.asp ... when i trigger this script from a link in an ...
    (microsoft.public.inetserver.iis)
  • Re: New Application problems
    ... Somethig in WIN XP changed the .CRD file type so that another app is now ... Windows Registry Editor Version 5.00 ... Double-clicking the filename brings up the file with the right ...
    (microsoft.public.windowsxp.customize)
  • Re: symbolic link problem
    ... I can't resist commenting on this proc. ... set rc [catch {is_broken $filename} result] ... puts "link $filename is OK" ...
    (comp.lang.tcl)
  • Re: cant open .xls files in Mac OS 9 classic
    ... It's a flaw with Excel 2001, unless the file type is "XLS8" (and the ... copy name of x as string to FileName ... set FileName to FileName & Suffix ...
    (microsoft.public.mac.office)
  • Re: How to set content-type header for ASP/HTML pages only ?
    ... >requires restarting IIS for it to take effect. ... >which is valid for other uses, just not for Content-Type. ... it sends the header for CSS ... >Is there any way to set the Content-Type specific to file type? ...
    (microsoft.public.inetserver.iis)