Author: Jackxxx | Posted on: 2/8/2009 7:53:27 AM | Views : 264

Can anyone tell me why an uploaded file would get locked by a session and how I can prevent this? If I try and upload the file again after the original upload and then view it in my gridview, I get an error that the file is open by another process.

Here is the code I use for the upload and viewing:Protected Sub ButtonUploadFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles ButtonUploadFile.Click

If FileUploadExcel.HasFile Then
Try
' alter path for your project
FileUploadExcel.SaveAs(Server.MapPath("~/Import/ExcelImport.xls"))
LabelUpload.Text = "Upload File Name: &q ...

Go to the complete details ...