Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Downloading IIS 5.1 & IIS 6.0

Status
Not open for further replies.

Rhys666

Programmer
May 20, 2003
1,106
I have some file download functionality in an ASP.net web application I'm currently working on which works splendidly on my local machine in development (Win XP Pro - IIS 5.1), but functions very differently when running on the test web server (Win Server 2003 - IIS 6.0).

Basically I have a link that opens my download page and the querystring of the page identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring, identifies the template required then uses the HttpResponse object to amend the current HttpResponse to clear the page content, append appropriate content-disposition and content-type headers stream the file to the HttpResponse and basically create the file download dialogue.

On my local machine this works fine and the download dialogue correctly identifies the file name and type attempting to be downloaded. However, when this is ported to the Test web server the download dialogue asks if I want to save or open the Download.aspx page, not the xls file that should be targetted. To further confuse me, if you save this file, open it in a text editor, leave the encoded elements, (square blocks, hex etc.), and save this as an xls file from the text editor MS Excel opens the saved file correctly and it is in fact the file that was attempted to be downloaded.

I'm not an IIS expert so am grasping at straws a little here, but does anyone have any experience of this behaviour, could it be an unrecognised MIME type, anything reasonable considered at this point as it's getting very annoying [mad]

Cheers

Rhys

""Vampireware /n/, a project, capable of sucking the lifeblood out of anyone unfortunate enough to be assigned to it, which never actually sees the light of day, but nonetheless refuses to die."

My Home
 
If you're still working on this...
maybe you need the file name in the header, we do like this...
Response.AddHeader("content-disposition", "attachment; filename=report.pdf");
If your app permits, you can just link to the files directly, like :
Code:
<a href='something.doc' target= '_blank'>the doc</a>
but then there's a security issue because these extensions don't trip the .NET security. If someone knew the entire URL they can download the doc unless you map it to the IISAPi.dll(sp?)
I'm reading this because I can't get Office files to download, but I can download PDFs. I'm thinking that IIS6 is locked down somwhere from downloading Office files.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top