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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top