Hi, In my application, i am downloading file from DMS system to my server. Once the file gets downloaded, on some environment, the iis keeps lock of the file and when the application tries to redownload the file and put the file on same location, an error is generated that file is being used by another process. Following is the code :
Try
Directory.CreateDirectory(serverPath.ToString)
downloadFilePath = serverPath.ToString & fileName
fileDownloaded = estimateFacade.DownloadFiles(dmsLinkID, downloadFilePath)
Catch threadex As System.Threading.ThreadAbortException
Catch ex As System.Exception
lblDownloadingcomment.Text = ex.Message
trButtons.Visible = True
btnDownload.Visible = False
'Throw ex
Finally
If Not fileDownloaded Is Nothing Then
fileDownloaded.Close()
End If
End Try