Пример #1
0
        /// <summary>
        /// 删除路径下相应文件
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteFile()
        {
            string path = PressRequest.GetQueryString("path").Trim();
            string url  = PressRequest.GetQueryString("url").Trim();

            if (System.IO.File.Exists(path) || Directory.Exists(path))
            {
                if (System.IO.File.Exists(path))
                {
                    System.IO.FileInfo file = new System.IO.FileInfo(path);
                    file.Delete();
                }
                else
                {
                    if (Directory.Exists(path))
                    {
                        DirectoryInfo di = new DirectoryInfo(path);
                        di.Delete(true);
                    }
                }
            }
            var fromurl = Request.UrlReferrer.ToString();

            return(Redirect(fromurl));
        }
Пример #2
0
 /// <summary>
 /// 删除路径下相应文件
 /// </summary>
 /// <returns></returns>
 public ActionResult DeleteFile()
 {
     string path = PressRequest.GetQueryString("path").Trim();
     string url = PressRequest.GetQueryString("url").Trim();
     if (System.IO.File.Exists(path) || Directory.Exists(path))
     {
         if (System.IO.File.Exists(path))
         {
             System.IO.FileInfo file = new System.IO.FileInfo(path);
             file.Delete();
         }
         else
         {
             if (Directory.Exists(path))
             {
                 DirectoryInfo di = new DirectoryInfo(path);
                 di.Delete(true);
             }
         }
     }
     var fromurl = Request.UrlReferrer.ToString();
     return Redirect(fromurl);
 }