asp.net如何实现Response下载文件不关闭父窗口? 是客户端设置呢,还是在.cs里处理呢? 谢谢!!有的机器运行asp.net点击打开文件不关闭父窗口,有的机器调用asp.net页面,点击打开文件关闭父窗口?怎么实现都不关闭父窗口?
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition","attachment;filename=" + HttpUtility.UrlEncode(fi.Name));
HttpContext.Current.Response.AddHeader("Content-Length",fi.Length.ToString());
HttpContext.Current.Response.ContentType="application/octet-stream";
HttpContext.Current.Response.WriteFile(fi.FullName,0,fi.Length);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition","attachment;filename=" + HttpUtility.UrlEncode(fi.Name));
HttpContext.Current.Response.AddHeader("Content-Length",fi.Length.ToString());
HttpContext.Current.Response.ContentType="application/octet-stream";
HttpContext.Current.Response.WriteFile(fi.FullName,0,fi.Length);
HttpContext.Current.Response.Flush();
解决方案 »
- B/S做国际化读取resx文件的问题!
- 关于ASPxGridView控件的DetailRowExpandedChanged事件的问题
- textbox TextMode=“Password” 后台怎么赋值
- 连接数据库后有点问题。
- 学asp.net要什么基础么
- 怎样控制弹出窗口的位置?
- 很急的问题
- ado.net中OleDb.OleDbDataAdapter不能用嵌套的sql语句么?
- 紧急求助:继承DataGrid控件时,如何加入另外的web控件呀??比如一个Label什么的
- 如何实现类似OUTLOOK 2000中邮件,日历,联系人等菜单点击弹出的功能
- 想实现新闻列表中是热点的 在标题前加红色的[热点] 怎么实现啊???
- 我怎么不能触发RadioButtonList的SelectedIndexChanged事件啊????
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(file.FullName);
Response.End();
用我的试试。
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(file.FullName);
Response.End();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(file.FullName);
Response.End();
当我点击按钮时,弹出窗口,窗口上面显示打开或者保存,关闭信息,当你点击打开或保存文件时,父窗口就关闭,我要求这个窗口不关闭,???如何实现,无论是客户端设置还是服务器端代码,只要实现就好!
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(file.FullName);
Response.End();
就是楼上的这个 我用过 这么多朋友都告诉你了
要是真的如你说的,你就做个弹出窗口
[email protected]
在页面加载事件里为按钮添加一个属性
button1.Attributes.Add("onclick", "this.form.target='_blank'");