Hi all,
I'm trying to force downloads from my page specifically for some powerpoint
and jpeg files. using the following code:
Response.ContentType= "APPLICATION/OCTET-STREAM";
string disHeader= "Attachment; Filename=\"" + sFileName + "\"";
Response.AppendHeader("Content-Disposition", disHeader);
System.IO.FileInfo fileToDownload= new System.IO.FileInfo(sDir + sFileName);
Response.WriteFile(fileToDownload.FullName);
Response.Flush();
Response.Close();
Response.End();
My problem is that this works fine on the development (windows XP Pro)
machine but when uploaded to production server (windows 2003 server) it
doesn't work. On the 2003 server it downloads a file with the correct
filename and extension but contains the webpage not the actual file
information!! any ideas??
Thanks
Gav
George Ter-Saakov - 27 Jul 2007 16:17 GMT
I think that you get exception somewhere between
Response.ContentType line and Response.End
Only that way I see how you can get an Html page.
My bet would be on security exception trying to access file. Or "file not
exists" exception
George.
> Hi all,
>
[quoted text clipped - 20 lines]
> Thanks
> Gav