下载的文件没有使用firefox的名称和扩展名

时间:2012-05-10 09:48:48

标签: firefox download

我有一些文件下载代码....除了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

0 个答案:

没有答案