I\'m new at web app in ASP.NET and I came across this problem.
I have a page whe there is a Button to download a template.xls that is previously stored at a SharePoi
i have solved this problem by another way
i open Window Task Manager and find that my dll file of my project is running
multiples ( i mean copy of it exists) i remove them and than my problem is solved
From what I can tell, you're opening the file-stream, and then trying to open it again, before you close it.
Initial opening of the file:
FileStream _FileStream = new FileStream(apPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
and
Response.TransmitFile(apPath);
seems to be trying to open the file again.
I would suggest calling
_FileStream.Close();
before calling TransmitFile
.