asp.net页面下载后,ie6窗体不关闭,ie7,8可以关闭
下载方法:private void DownLoad(string path, string filename, string filetype)
{
try
{
path = Server.MapPath(path);
FileInfo fileInfo = new FileInfo(path);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = filetype;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.WriteFile(fileInfo.FullName);
Response.Write("<script>window.close();</script>");
Response.Flush();
Response.End();
}
catch (Exception ex)
{
Response.Write(ex.ToString()); Response.Write("<script>window.close();</script>");
}
finally
{
Response.Write("<script>window.close();</script>");
}
}
谢谢啦
补充:.NET技术 , ASP.NET