File.Delete(path)是否使用服务器的凭据或用户凭据?

时间:2014-10-08 18:11:18

标签: c# asp.net iis iis-7 directory

该网站正在使用Windows身份验证。

我在自定义错误页面上收到错误当我们托管一个我们有权访问该目录的开发站点时,这个想法运行良好。

但现在我想知道该网站是否被拒绝访问它的读/写权限

private void Page_Load(object sender, System.EventArgs e)
        {

            string path = Server.MapPath("~/UserData/ErrorLog/");
            int fileCount = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Length;
            if (fileCount > 10)
            {
                //Directory.Delete(Server.MapPath("~/UserData/ErrorLog/"),true);
                string[] txtList = Directory.GetFiles(path, "*.*");
                foreach (string f in txtList)
                {
                    File.Delete(f);
                }


                //Directory.CreateDirectory(Server.MapPath("~/UserData/")+"ErrorLog/");
            }
            // Put user code to initialize the page here
            //Exception ex = Server.GetLastError();
            Exception ex = (Exception)Application["LastError"];
            string message = ex.ToString();
            string date = DateTime.Now.ToString("ddMMyyyy");
            string filename = HttpContext.Current.Request.MapPath("~/UserData/ErrorLog/") + "Error" + date + ".log";

            //more code that is irrelevant
    }

0 个答案:

没有答案