Every now and then when trying to read a file I get a “Access to the path ‘xyz’ is denied (System.IO.__Error.WinIOError)” error.
What I don’t understand is how it can have access most of the time but not every once in a while. I can even access the txt file directly via the web as its not protected in anyway.
Its not a concurrency problem, well I don’t think so, because I also get a “The process cannot access the file ‘xyz’ because it is being used by another process. (System.IO.__Error.WinIOError)”. I expect this one to some extent as the website is running multiple processes.
Does anyone know why I would be getting the “Access to the path ‘xyz’ is denied” error?
Yes, as stated above, it sounds like the file writer is not be disposed of correctly. When do you write to this file? As if you try reading it while you are writing to it, it will throw this error.
And on a side note, y not use xml to cache or a local database? Local db would be best option as it is highly optimised for multiple connections
Its one of two, security reasons or file access denial. If it’s security reasons then it should happen all the time, so my best guess is file access issues.
How do you access the file? is the object disposed after each call to it?
Sorry I guess I wasn’t totally clear… thats not the error I’m asking about… I mentioned 2 errors the one you refer to I understand, and the other which I do not.
I should say cached content… its not variable, nor private, but its pulled from a database on a separate server and the connection sometimes goes down, hence the text files.