Web/File/DelFile.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using COCOWO.COMP;

public partial class File_DelFile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // page requires a querystring like: Type=File&Name=someName OR Type=Folder&Name=someName
        if (Request.QueryString["Type"] != null && Request.QueryString["Name"] != null)
        {
            // check for the File querystring parameter
            if (Request.QueryString["Type"].ToString() == "File")
            {
                FileInfo file = new FileInfo(Server.MapPath(Request.QueryString["Name"].ToString()));
                try
                {
                    file.Delete();
                    Response.Redirect("default.aspx");
                }
                catch 
                {
                    Response.Write("<script>alert('出错了,等一会儿再操作吧!!');window.location.href='Default.aspx'</script>");
                }

            }
            else if (Request.QueryString["Type"].ToString() == "Folder")
            {
                try
                {
                    string path = FTP.getParentDirectory();
                    DirectoryInfo dir = new DirectoryInfo(Server.MapPath(Request.QueryString["Name"].ToString()));
                    dir.Delete();

                    Response.Redirect("default.aspx?Path=" + path);
                }
                catch (IOException IOEx)
                {
                    Response.Write("<script>alert('出错了,等一会儿再操作吧1!!');window.location.href='Default.aspx'</script>");
                }
                catch (Exception ex)
                {
                    Response.Write("<script>alert('出错了,等一会儿再操作吧2!!');window.location.href='Default.aspx'</script>");
                }
            }
            else
                Response.Write("<script>alert('出错了,等一会儿再操作吧3!!');window.location.href='Default.aspx'</script>");
        }
        else
            Response.Write("<script>alert('出错了,等一会儿再操作吧4!!');window.location.href='Default.aspx'</script>");
    }
后面还有 1 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。