Hi
I am working on ASP.NET 2.0, trying to download an excel file from the web server.This code is written in a pop up window. I got the code snippet for downloading from the following link :http://www.xefteri.com/articles/show.cfm?id=8 . Its given below also:
Dim filePath As String = "\Bin\DownloadBOQ\sampleFile.xls"
Dim path As String = Server.MapPath("..\..\" + filePath)
Dim file As FileInfo = New FileInfo(path)
If file.Exists Then
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" & "sampleFile.xls")
Response.AddHeader("Content-Length", file.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(file.FullName)
Response.End() '******************** EXCEPTION"********************************
End If
I am having two issues::
1. The file is not getting downloadeD. the pop up window hangs
2. An exception occures whlile executing the 'Response.End() ' line . The exception is "System.Threading.ThreadAbortException"
Please Help me to rectify these two issues.
Thanks,
Dinesh
Dont forget to click “Mark as Answer” on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.