1 Attachment(s)
[RESOLVED] Missing a MIME entry on downloading a TEXT file?
Help
This code worked fine on my clients 2003 server for simply downloading a TEXT file
Response.Clear()
Response.ContentType = "text/plain"
Response.AppendHeader("Content-Disposition", String.Format("attachment;filename={0}", %Trim(savename)))
Try
Response.TransmitFile(thePath)
Catch e1 System.Exception
Message = e1.ToString()
ltlAlert.text = "alert('" + Message + "')"
leavesr
EndTry
Response.End()
However -- they are going to a 2008 server and it no longer functions. What it downloads is the HTML of the page where the download button it. Please see attached.
What am I missing in the 2008 IIS configuration? A mime type??
thanks
gollnick
Re: Missing a MIME entry on downloading a TEXT file?
Aww come on now.. There is not ONE person from Microsoft or someplace that has an answer for this?
gollnick
Re: Missing a MIME entry on downloading a TEXT file?
Well first, I don't think the people from Microsoft hang out around here... they have their own playground to hang in. Secondly, you're counting on someone having encountered this problem before.... I know I haven't. And I can't say I recall seeing any other posts that come close to this kind of problem. What I do know is that I have done server side work before in downloading files and I've never response.transmitfile ... didn't even know it existed. I've always created a stream and then used the ResponseStream (from Response.GetStream) to send the file (including mime headers) back to the client. That's how we send XML, Excel, and csv files to the client browser for downloading. As long as there's data in the stream (occasionally we run in to the accidental case where there isn't and it generates an error) the user then gets prompted for the download location of the file. It seems to be stable and has always worked for me.
-tg