Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Response.Writefile problems on 2003 server

Reply
Thread Tools

Response.Writefile problems on 2003 server

 
 
=?Utf-8?B?R2F2?=
Guest
Posts: n/a
 
      07-27-2007
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
 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      07-27-2007
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.


"Gav" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrading from x32 Server 2003 r2 to x64 server 2003 r2 clucas009 Windows 64bit 4 03-26-2009 11:38 PM
Deploying Business Desktops with Microsoft Windows Server 2003 and Microsoft Office 2003 Karthik Ragavan Microsoft Certification 0 08-17-2005 05:08 PM
Beta Exam 71-139: Deploying Business Desktops with Microsoft Windows Server 2003 and Microsoft Office 2003 lowdes MCSE 1 07-19-2005 02:45 PM
Windows 2003 Server or Exchange Server 2003 first????? Ozzie MCSA 1 11-30-2004 01:10 AM
Server 2003 or Space Cadet 2003? MF MCSE 7 02-16-2004 05:39 PM



Advertisments