Hi all
I am downloading a .csv file will some data in it. The code that I am using is as follows:
The issue that I am experiencing is that when the user clicks the "Open" button, I get the following error message:
Any suggestions? Should I be employing a different means of downloading the file?
Mike55.
I am downloading a .csv file will some data in it. The code that I am using is as follows:
Code:
Private Sub DownloadFile(ByVal filePath As String, ByVal fileName As String)
Dim fs As FileStream
Open the file.
fs = File.Open(filePath, FileMode.OpenOrCreate)
Dim byBytes(Convert.ToInt32(fs.Length)) As Byte
fs.Read(byBytes, 0, Convert.ToInt32(fs.Length))
fs.Close()
Delete the file from the system.
If Not fileName = "SampleCSV.csv" Then
File.Delete(filePath)
End If
Response.AddHeader("Content-disposition", "attachment; fileName=" + fileName)
Response.ContentType = "application/octet-stream"
Response.BinaryWrite(byBytes)
Response.End()
The issue that I am experiencing is that when the user clicks the "Open" button, I get the following error message:
C:\Documents and Settings\user\Local settings\Temporary Internet Files\Content.IE5\0t6lg1s3\SampleCSV[1].csv Could not be found. Check the spelling of the file name, and verify that the location is correct. If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.
Any suggestions? Should I be employing a different means of downloading the file?
Mike55.