Hi !
here's the code of the function I use to send a file to the client :
Private Function SendFile(ByVal fich As String, ByVal nom As String) As Boolean
Try
Dim oldCT As String = Response.Conten tType
Response.Clear( )
Response.Conten tType = "applicatio n/octet-stream"
Response.AddHea der("Content-Disposition", "attachment ; filename=""" & nom & """")
Dim fi As IO.FileInfo = New IO.FileInfo(Ser ver.MapPath("fi chiers\") & fich)
If Not fi.Exists Then
Return False
Exit Function
End If
Dim fs As IO.FileStream = fi.OpenRead
Dim tab(fs.Length) As Byte
fs.Read(tab, 0, fs.Length)
fs.Close()
Response.Binary Write(tab)
Response.Flush( )
Response.Close( )
Response.Clear( )
Response.Conten tType = oldCT
Return True
Catch ex As Exception
Return False
End Try
End Function
When I call it, the transfer works fine, the file is ok, but the web application stops responding to the client. When the client clicks a link or tries to do something on the page, nothing happens and the status bar indicates "Error on page"
Has someone an idea ?
Thanks in advance
--------------------------------
From: frenchie seb
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>xRjvRvO3c06 p6Q698UYtfA==</Id>