asp.net下载文件时出错!!
Dim Filepath As String = Label7.Text
Dim fileStream As New FileStream(Filepath, FileMode.Open)
Dim fileSize As Long = fileStream.Length
Dim inta As Integer = CInt(fileSize)
Dim OutPutFileName As String = " linkbutton1.text" Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & HttpUtility.UrlEncode(OutPutFileName, System.Text.Encoding.UTF8))
Response.AddHeader("Content-Length", fileSize.ToString())
Dim fileBuffer(inta) As Byte
fileStream.Read(fileBuffer, 0, inta)
fileStream.Close()
Response.BinaryWrite(fileBuffer)
Response.End()
linkbutton1.text为下载的文件文件名。。但是下载下来的文件却没有后缀,无法打开。。。为什么??
------解决方案--------------------
Dim OutPutFileName As String = linkbutton1.text
不要引号