You might like this :)
It is token from some script you might change things but you'll get the
idea. Use Content-Disposition; attachment and not 'inline'...
Response.Buffer = False
Set the content type to the specific type that you are sending.
Response.ContentType = "application/vnd.ms-excel"
Dim strFilePath, lSize, lBlocks
Const CHUNK = 2048
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
lSize = objStream.Size
Response.AddHeader "Content-Length", lSize
Response.AddHeader "Content-Disposition", "attachment; filename=" + strFile
lBlocks = 1
For lBlocks = lBlocks To lSize \ CHUNK
If Response.IsClientConnected = False Then Exit For
Response.BinaryWrite objStream.Read(CHUNK)
Next
lSize = lSize MOD CHUNK
If lSize > 0 And Response.IsClientConnected = True Then
Response.BinaryWrite objStream.Read(lSize)
End If
'
objStream.Close
'<!--object id="objStream" progid="ADODB.Stream" runat="server"></object-->
%>
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm
"jim" <ji********@nospamforum-financial.com> wrote in message
news:0e****************************@phx.gbl...
I'm trying to stream a html page to the user as an excel
file.
I'm currently using
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "inline;
filename=download.xls "
The actual streaming and excel file are working fine but
in excel its not picking up the filename its actually
showing up as the url to the page that downloads this. I
would like to show up as download.xls or something similar
even if the path points to the web directory. Any help
would be greatly appreciated.
Thanks
Jim