We are a new DASP client. Previously our websites were hosted on our own servers which made things rather simple. We have one domain with a subdomain such as: www.mydomain.com support.mydomain.com We modified our default page to redirect support.mydomain.com to www.mydomain.com/support No problems there. Now our users who are visiting our support.mydomain.com site see our support site web application. They login to that site to download software updates and various drivers. We created a folder for example called /downloads. The folder resides at www.mydomain.com/support/downloads/ On our old site, this folder was a virtual directory. To prevent direct linking to our files, we have a download page that pushes it out as a binary stream. This helps us hide the actual path. This worked just fine on our old site using our own servers. If I paste the path to any file into a browser it works fine. Serves up the file. However, our downloads page that attempts to stream the file fails. I'm not really sure why. I have verified that the code that gets our path does get the correct path by dumping the contents of the string (dwFilePath) onto a page so I can see it. Any ideas on why this would be failing? Dim dwfilePath As String = Server.MapPath("/support/downloads/" & filepath) Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(dwfilePath) Response.Clear() Response.AddHeader("Content-Disposition", "attachment; filename=" + targetFile.Name) Response.AddHeader("Content-Length", targetFile.Length.ToString) Response.ContentType = "application/octet-stream" Response.Write(dwfilePath) One additional note.... It does "appear" to serve up the file. However what you get is a file with the correct name (xyz.exe) but its actually a txt file containing what you see on the page where the original link was at. Help!! This one is tough!
Ahh Not so tough... figured it out for those that stumble as well. Use Response.WriteFile -- NOT -- Response.Write