Response.Writefile problems on 2003 server

G

Guest

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
 
G

George Ter-Saakov

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top