access path denied
I had applied the following code as said by you :
开发者_运维知识库byte[] b = YourByteArrayFromDb;
File.WriteAllBytes(MyFilePath, b);
But I am receiving an exception "Access to the path is denied". How do I solve this using ASP.Net with C# ? And is there any format to set the path as string ?
There is file access audit in Windows. You can use it to get detailed info about access faults. All events will be collected into Security Event Log. Steps to achieve:
- Define audit on the "C:\Users\attilah\" directory or whole disk via Property->Security->Audit
- Switch on audit in the Local Security Policy (Control_Panel->Administrative_Tools)
- Look for events in the Security Event Log
Second method is using Process Monitor by Mark Russinovich (www.sysinternals.com)
Apply any method to diagnose a problem.
I think The error message is loud and clear. You DONT have permission to write to that path. Check the permission for the user under which you are trying to write the file.
I have recently run into the same problem, when trying to edit a file copied from a CD-ROM. The file still had its Read-Only attribute on, which caused the very same error.
精彩评论