⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download.aspx.cs

📁 OA自动化办公系统,就是OA自动化办公系统
💻 CS
字号:
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 COM.OA.Entity;
using COM.OA.BLL;
using System.Collections.Generic;

public partial class qs_wenjian_download : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        //string fileName = Request.QueryString["n"];//获取文件名
        int f_id = Int32.Parse(Request.QueryString["id"]);//获取文件的ID
        files fss = filesBLL.Select(f_id);
        string fileName = fss.f_filename;

        System.IO.FileStream fs = null;
        fs = System.IO.File.Open(Server.MapPath(@"../gxxz/upload/" + fileName), System.IO.FileMode.Open);
        byte[] btFile = new byte[fs.Length];
        fs.Read(btFile, 0, Convert.ToInt32(fs.Length));//将文件读到数组中
        fs.Close();
        string strFileName = "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);
        this.Response.AddHeader("Content-disposition", strFileName);
        this.Response.ContentType = "application/octet-staream";
        this.Response.BinaryWrite(btFile);


        //修改此文件的的下载次数
      //  string where = "f_id=" + f_id;
       // IList<files> list = filesBLL.Select(where);
       // files f = list[0];
       // f.f_readdegree += 1;
       
       // filesBLL.Update(f);
        this.Response.End();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -