December 2009 Entries

System.UnauthorizedAccessException: Access to the path is denied

Technorati Tags: C# I came across this pain in the ass error today...pretty common I guess.  I was trying to do a System.IO.File.Move (which is in essence a copy as we all know) and kept getting the error System.UnauthorizedAccessException: Access to the path is denied. The code: private void RenamePhysicalFile(string uploadedFileName) {     string existingFile = Path.Combine(SoePath, uploadedFileName);     if (File.Exists(existingFile))     {         try         {             string newFile = Path.Combine(SomePath, existingFile.Replace(existingFile.Substring(0, existingFile.IndexOf("-")), someTestString));            ...

posted @ Monday, December 14, 2009 10:16 PM | Feedback (1)