Response.Redirect : default file name

  • Thread starter Thread starter mamin
  • Start date Start date
M

mamin

Hi,
Im trying to send bmp file to client using Internet Explorer 6.0. So my
code is:


string bmpFilePath=@"c:\1.bmp";
Response.ContentType="application/bmp";
Response.AppendHeader("","attachment; filename=\"" + bmpFilePath +
"\"");
Response.WriteFile(bmpFilePath);
Response.Flush();
Response.End();

The problem is, that when cient is saving this file, the default name
for this file is not 1.bmp but the same as my aspx for example
WebForm1.aspx . How to change it?
 
You need to add the header name, "content-disposition", .e.g.

Response.AppendHeader("content-disposition", "attachment;
filename=1.bmp");
 
Response.AppendHeader("content-disposition", "attachment;
filename=1.bmp");

It doesn't work.Default name for transmitted file is still
WebForm1.aspx. Anyone knows why?
 
Back
Top