In C #, Io classes in. NET are powerful, but they are not practical on servers of many virtual service providers because of their powerful functions. Because Io. directory and Io. in the Application folder operation, directoryinfo traverses the disk and directory of the hard disk where the website is located. Generally, the virtual service provider does not enable the read permission for the network service user of the disk.CompositionWhen using the two classes under I/O, the following error occurs:
Part of path "E: \" is not found.
Note:An error occurred while executing the current Web request. Check the stack trace information to learn about this error andCodeDetailed information about the cause of the error.
Exception details:System. Io. directorynotfoundexception: Part of path "E: \" is not found.
Source error:
An unhandled exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception. |
Stack trace:
[Directorynotfoundexception: Part of path "E: \" is not found.] System. Io. _ error. winioerror (int32 errorcode, string Str) + 287
|
The path E:/is not found, and the path e is the disk path on the server, which may vary depending on the server. In the face of this problem, what should I do if the service provider refuses to grant you more permissions?
Haha, it may be because I have a poor foundation, So I went online to seek answers, but I couldn't find the answers. By accident, it was found that ASP could apply FSO to create folders. So I used Asp.net to call the FSO component in the window. Well, it's a success.ArticleTo those friends and brothers who suffer from this problem.
Project-> reference and browse COM component Microsoft scripting Runtime
Scripting. FileSystemObject FSO = new scripting. filesystemobjectclass ();
FSO. createfolder (PATH)
But the premise of this solution is that the virtual service provider has enabled FSO.
The reason why I/O operation folders have two classes traverse the root directory of the disk is still being studied, but the problem is finally solved. I hope anyone who understands this can give you an answer.