Domain:域名,地址名;
folderURL:Domain+文件夹名
如下就会在Domain一个文件夹
public bool CreateFolder(string folderURL)
{ try { WebRequest request = WebRequest.Create(folderURL); request.Credentials = System.Net.NetworkCredential(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["UserPassword"], ConfigurationManager.AppSettings["Domain"]); request.Method = "MKCOL"; WebResponse response = request.GetResponse(); response.Close(); return true; } catch (WebException ex) { return false; } }但以上只能一次建一个文件夹,像abc\bbc两级目录是不行的,只能先建abc 再在职abc下建bbc.