我在codebehind(vb)上使用了以下脚本,但在模态弹出页面上使用或执行时似乎无效。
对此有何建议或解决方法?
Dim filepath As String = Request.Params("file")
If Not filepath Is Nothing Then
filepath = rootstore & filepath
If System.IO.File.Exists(filepath) Then
Dim filename As String = System.IO.Path.GetFileName(filepath)
Response.Clear()
Response.ClearHeaders()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" + Request.Params("file"))
Response.ClearContent()
Response.WriteFile(filepath)
Response.End()
HttpContext.Current.ApplicationInstance.CompleteRequest()
End If
End If