我使用下面的代码来下载Excel文件。一旦Response.End()
调用运行,我想关闭窗口。但是,这没有发生。请参阅下面的代码。Response.End()之后关闭窗口?
'Write it back to the client
Dim filename As String = "FullExtract_" & Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & ".xlsx"
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", "attachment; filename=" & filename)
Response.BinaryWrite(pck.GetAsByteArray())
Response.End()
'cursor not reaching to below code
Page.ClientScript.RegisterStartupScript(Me.GetType(), "closedownload", "JavaScript:window.close(); return false;")
我怎么关闭窗口?
当你调用'Response.End'时,它会停止执行页面,所以它不会进一步处理页面。看看这个:http://msdn.microsoft.com/en-us/library/system.web.httpresponse.end.aspx。 – 2012-04-02 20:05:14
关闭窗口的任何建议。 – James123 2012-04-02 20:06:07