Asp.net solution for Folder creation error

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.