I am using WebMethod and File.Move
But my problem is the file is being locked by the WebMethod and it cannot be moved again (I want to rename it, not move it)
The exception thrown is "The process cannot access the file because it is being used by a another process"
How do I solve this?
I probably googled for half an hour
Here is my code:
[WebMethod]
public void EditFile(string FilePath, string NewName, string OldName)
{
File.Move(FilePath + OldName, FilePath + NewName);
}


Sign In
Create Account


Back to top









