Publics/FileDownLoad.ashx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.SessionState;

namespace 客户订单管理2.Publics
{
    public class FileDownload : IHttpHandler, IRequiresSessionState
    {
        SqlCommandBuilder scb;
        SqlDataAdapter 数据适配器;
        SqlConnection 数据连接;
        DataTable 主表 = new DataTable();

        public void ProcessRequest(HttpContext context)
        {
            #region 权限检查
            if (context.Session["login"] == null || context.Session["login"].ToString() != "true")
            {
                context.Response.Write("<script>top.location.href='../Default.aspx';</script>");
                context.Response.End();
                return;
            }
            if (!系统.权限检查(context.Session["pageTitle"].ToString(), context.Session["username"].ToString(), context.Session["userclass"].ToString()))
            {
                context.Response.Write("<script>alert('缺少访问权限 !(请联系管理员)');</script>");
                context.Response.Write("<script>history.go(-1);</script>");
                context.Response.End();
                return;
            }
            #endregion

            string sql = "select * from 系统_文件仓库 where ID = " + context.Session["keyValue"].ToString();
            数据连接 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["默认连接_3HK0R6GAS"].ConnectionString);
            数据适配器 = new SqlDataAdapter();
            数据适配器.SelectCommand = new SqlCommand(sql, 数据连接);
            scb = new SqlCommandBuilder(数据适配器);
            try
            {
                数据连接.Open();
                数据适配器.Fill(主表);
                数据连接.Close();
                MemoryStream ms = new MemoryStream((byte[])主表.Rows[0]["附件"]);
                BinaryReader br = new BinaryReader(ms);
                int count = (int)ms.Length;
                byte[] bytes = new byte[count];
                bytes = br.ReadBytes(count);
                context.Response.Charset = "UTF-8";
                string fileName = 主表.Rows[0]["文件名称"].ToString().Trim();
                string UserAgent = context.Request.ServerVariables["http_user_agent"].ToLower();
                if (UserAgent.IndexOf("firefox") >= 0)
                {
                    Base64 base64 = new Base64();
后面还有 34 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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