Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save to Disk IE7 vs IE6

Status
Not open for further replies.
Jun 5, 2006
28
US
Hi,
I have a modal dialog (window.showModalDialog) which contains the following link:
<a href='download.aspx?file=test.txt'>" + "test" + "</a>

Note: This issue only arises when the link is clicked from inside a modal dialog window.

IE6
When i click the link a blank window shows up, and then and then "save to dialog" box appears to save the file. The issue is why doesnt the blank window disappear and how can I make it disappear? (doing a window.close, cause the "save to dialog" box to disappear also.)




IE7
When i click the link a blank window shows up, and then almost immediately disapears and then "save to dialog" box appears to save the file.

Code of download.aspx:

string strRequest = Request.QueryString["file"];
if (strRequest != "") {
string path = Server.MapPath(strRequest);
System.IO.FileInfo file = new System.IO.FileInfo(path);

if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top