K
Ken Varn
I have an ASP.NET page that incorporates the following code on a button
press.
private void DownloadTag_Command(object sender, CommandEventArgs e)
{
FileStream fs;
String Filename;
Filename = MapPath(e.CommandArgument as string); // Name of file
is passed in cmd arg.
fs = File.Open(Filename, FileMode.Open);
byte[] byteBuffer = new byte[fs.Length];
fs.Read(byteBuffer, 0, (int)fs.Length);
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=" +
Path.GetFileName(Filename));
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(byteBuffer);
Response.End();
}
When clicking on my download button in IE, the download will call up the
download file dialog as expected. If I click on Save on the download file
dialog the file downloads without any problem. However, if I click on open,
I get a second download file dialog box with the same file. Not sure why.
If I click on open on this second dialog, the file will download and open as
expected.
Could someone explain how to eliminate this second download file dialog?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
press.
private void DownloadTag_Command(object sender, CommandEventArgs e)
{
FileStream fs;
String Filename;
Filename = MapPath(e.CommandArgument as string); // Name of file
is passed in cmd arg.
fs = File.Open(Filename, FileMode.Open);
byte[] byteBuffer = new byte[fs.Length];
fs.Read(byteBuffer, 0, (int)fs.Length);
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=" +
Path.GetFileName(Filename));
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(byteBuffer);
Response.End();
}
When clicking on my download button in IE, the download will call up the
download file dialog as expected. If I click on Save on the download file
dialog the file downloads without any problem. However, if I click on open,
I get a second download file dialog box with the same file. Not sure why.
If I click on open on this second dialog, the file will download and open as
expected.
Could someone explain how to eliminate this second download file dialog?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------