• 在Domin里新建文件夹代码


    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.

  • 相关阅读:
    长沙集训day6
    长沙集训day5(总结)
    长沙集训day4(总结)(爆零记)
    长沙集训day3(总结)(爆零记)
    长沙集训day2(总结)
    长沙集训day1(总结)
    p1324 dining(晚餐)
    p1156集合删数
    1034: [ZJOI2008]泡泡堂BNB
    清北学堂Day 6 游记
  • 原文地址:https://www.cnblogs.com/springyangwc/p/1955367.html
Copyright © 2020-2023  润新知