简体   繁体   中英

How to create Folder and files on Server using .net windowsForm

I am working on windows form, i have one task to create directory and files on My client server using windows Form. So how can i create Directory and Files on Client

Server using my windows/Desktop Application.

Thanks

I have no idea.. Means how can i authenticate my desktop to My Live Server

I was Just trying that code but its not working

string path= "\\ipaddress\\Templates\\";
System.IO.Directory.CreateDirectory(@path);

If i try this one

string path = "\\123.100.000.000\KapilSearch\";

I am having following error

[Error  1   Unrecognized escape sequence]
[Error  2   Newline in constant]

Your path is escaped incorrectly. You have two options.

string path= @"\\ServerName\ShareName\targetnewfolder";
System.IO.Directory.CreateDirectory(path);

or this:

string path = "\\\\ServerName\\ShareName\\targetnewfolder";
System.IO.Directory.CreateDirectory(path);

Note the @ in front of the open string - and that the slashes are equal to the number you would use in windows explorer - no escapes required when using the @ modifier. Note also, no @ sign in the CreateDirectory argument.

如果你问如何创建一个目录,那么这很简单,只要: Directory.CreateDirectory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM