1

我有一些用于文件下载的代码..除了Firefox之外,它工作正常..在Firefox上,它下载一个没有名称和扩展名的未知文件......我不明白我需要什么才能让它工作在Firefox上也是如此..希望有人可以向我指出一些事情..谢谢..

     Dim filePath As String = "\\server\downloads\" + "Myfile" + " " + loginID + ".xml"

     Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(filePath)

     If targetFile.Exists Then
         Dim objFileInfo As FileInfo

         Try

             objFileInfo = New FileInfo(filePath)
             Response.Clear()
             Response.Cache.SetCacheability(System.Web.HttpCacheability.Private)
             Response.AddHeader("Content-Disposition", "attachment; filename=" & objFileInfo.Name)
             Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
             Response.ContentType = "application/octet-stream"
             Response.WriteFile(filePath)
             Response.End()

             'show data in the gridview                        

         Catch ex As Exception
             Throw ex
         End Try
     Else
          Messagebox("Sorry no such file exists")
     End If
4

0 回答 0