在模态弹出页面上执行时,文件下载对话框不起作用

时间:2013-01-30 09:20:54

标签: asp.net vb.net

我在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

0 个答案:

没有答案