Author: sixtus | Posted on: 7/19/2009 12:44:12 AM | Views : 1259

I have just switched to ASP.NET 3.5, IIS 7.0 and Windows 2008.
On my website users can upload files and then later download these files. This worked fine before upgrading. But now the download of files doesn't work.
To download files I activate a link like download.aspx?file=test.txt, where test.txt is the file to be downloaded. This file is placed in a folder on the webserver.
The (importent part af the) code in download.aspx is:
Dim filepath As String = Server.MapPath(Request("file"))
Dim file As System.IO.FileInfo = New System.IO.FileInfo(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Length", file.Length.ToString())
Response.AddHeader("Content-Disposition", "attachment; filename=""" & tilpasfilnavn(file.Name) & """")
Response.Flush()
Response.Writefile(filepath ...

Go to the complete details ...