Response.Redirect : default file name

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?
 
C

Chris Fulstow

You need to add the header name, "content-disposition", .e.g.

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

mamin

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

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

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top