PDA

View Full Version : 'Save As' dialog box in ASP.NET....Urgent



mehtavipulk
Sep 9th, 2005, 11:45 AM
Hi Friends,
On click of a button following logic is been executed which pops up an 'Save As' dialog box. When user clicks the button for 3rd time / more then twice the browser gets hanged. Why does this happen?

Private Sub DownloadFile(ByVal strFileName As String)
'
Try
'
Dim objFilePath As String = Server.MapPath("/GrantDoc/Downloadable Documents/" & strFileName)
Dim objTargetFile As System.IO.FileInfo = New System.IO.FileInfo(objFilePath)
'
If objTargetFile.Exists Then
'
With Response
.Clear()
.ContentType = "application/octet-stream"
.AddHeader("Content-Disposition", "attachment; filename=" + objTargetFile.Name)
.AppendHeader("Content-Length", objTargetFile.Length.ToString)
.WriteFile(objTargetFile.FullName)
End With
'
End If
Catch objEx As Exception
Dim lobjCommCls As New GMS.ClassLibrary.clsCommonClass
marrError = lobjCommCls.fnReturnError(marrError, "", objEx, "DownloadFile()", False)
Throw New Exception
End Try
'
End Sub


Regards,
Vipul Mehta

nikkiH
Sep 9th, 2005, 06:27 PM
I don't see you releasing system resources here...
Aren't you supposed to be setting things like file references to Nothing for VB?