asp.net the IO class to create a folder

Source: Internet
Author: User
Tags execution stack trace root directory
Asp.net| Create | problem

The IO classes in. NET in C # are powerful, but they are not practical in many virtual service servers because of their powerful features. Because Io.directory and Io.directoryinfo in the application folder operation, will traverse the Web site's hard disk and directory, the general virtual service provider does not give the disk Network service users to open read access, so in the operation of the folder, The following error occurs with these two classes under IO
A part of the path "E:\" was not found.
Note: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code.

Exception Details: System.IO.DirectoryNotFoundException: Part of the path "E:\" was not found.

SOURCE Error:

An unhandled exception was generated during the execution of the current WEB request. You can use the following exception stack trace to determine information about the cause of the exception and where it occurred.

Stack trace:

[DirectoryNotFoundException: Part of the path ' e:\ ' was not found. ]
System.io.__error.winioerror (Int32 errorcode, String str) +287
System.IO.Directory.InternalCreateDirectory (string fullpath, String path)
+489system.io.directory.createdirectory (String Path)
+195system.io.directory.createdirectory (String Path)
+195system.io.directory.createdirectory (String Path)
+195system.io.directory.createdirectory (String Path)
+195                                                                                                                                                                                                                                    
System.IO.Directory.CreateDirectory (String path) +195


--------------------------------------------------------------------------------

Version information: Microsoft. NET Framework Version: 1.1.4322.2300; asp.net version: 1.1.4322.2300

The path e:/,e disk is not found on the server, and may vary depending on the server. Faced with this problem, the service provider will not give you more permission to open the case, how to solve it?

Oh, may be because I am relatively poor foundation, so the internet to seek answers, but hard to find the answer. Accidental once, found that ASP can apply FSO to create folders. So I thought of using asp.net to invoke the FSO component in window. Oh, incredibly successful, close-up this article to those who suffer from this problem should not be resolved friends and brothers.

Project-> References Browse COM components Microsoft scripting Runtime

Scripting.FileSystemObject fso=new Scripting.filesystemobjectclass ();

Fso. CreateFolder (Path)

, but this solution is based on the premise that the virtual service provider opened the FSO

As for the IO Operation folder Two classes why will traverse the disk root directory is still in the study, but the problem is finally solved, I hope that people who know 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.