disk/_admin/manager/disk_ResourceFile/disk_Down.ashx

(开头部分) 1KB

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

<%@ WebHandler Language="C#" Class="disk_Down" %>

using System;
using System.Web;
using WebDisk_BLL;
using WebDisk_Model;
using System.IO;
public class disk_Down : IHttpHandler {

    public void ProcessRequest(HttpContext context)
    {
       
        context.Response.ContentType = "text/plain";
        if (context.Request["id"] != null)
        {
            disk_ResourceFile_BLL dataOper = new disk_ResourceFile_BLL();
            disk_ResourceFile_Model model = dataOper.GetModel(new Guid(context.Request["id"]));

            if (model == null)
            {
                context.Response.Write("不存在资源");
                context.Response.End();
            }

            string dir = String.Format(
                    context.Server.MapPath(
                        String.Format("~/{0}", model.df_path)
                    )
                );


            if (!File.Exists(dir))
            {
                context.Response.Write("不存在资源!");
                context.Response.End();
            }
            if (model != null)
            {
                string fileName = model.df_name;
                
               
                context.Response.ContentType = "application/octet-stream";
                context.Response.AppendHeader("Content-Length ", model.df_size.ToString());
                context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                context.Response.AddHeader(
                    "Content-Disposition", String.Format("attachment;filename={0}{1}",   HttpUtility.UrlEncode(fileName),model.df_ext)
                    );
                context.Response.TransmitFile(dir);
            }

           
            
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }

后面还有 8 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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