While trying to read a file from my ASP.NET web application using this method:
string strContents;
using (StreamReader sr = new StreamReader(strFilePath))
{
strContents = sr.ReadToEnd();
}
I get the following exception:
The process cannot access the file 'file_path' because it is being used by another process.
So I'm curious, is there any way to know what's locking this file?
PS. It'd be nice to know this from inside the exception and if that's not possible, is there any way to know it somehow else?