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