回 帖 发 新 帖 刷新版面

主题:使用Response.ContentType后页面刷新问题

我在网页中使用
Response.ContentType="application/octet-stream"
Response.AddHeader "content-disposition","attachment;filename=jhs.doc"
将查询结果导出到word文档jhs.doc中。但导出完成后,要将页面刷新时却发现了问题,如果用
  Response.Write "<script language=javascript>window.location.href='programMain.asp';</script>",将页面重新调用一次,却不起作用,如果用Response.Redirect('programMain.asp'),又无法导出word文档,直接转向了。请问有什么办法解决?

回复列表 (共1个回复)

沙发

1、已经指定为“附件”了,当然无法再执行脚本了,

2、Response.Redirect(...)会中止代码的运行,直接跳转。所以剩下的代码无法继续执行。

我来回复

您尚未登录,请登录后再回复。点此登录或注册