📄 frmdownload.aspx.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 System.Data.Common;
//该源码下载自www.51aspx.com(51aspx.com)
public partial class frmDownload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string studentid = Request.Params["StudentID"];
string Name = Request.Params["Name"];
DataTable dt = Global.GetFieldsFromTablesByCondiction("*",
"View_PaperPartInfo","studentid =" + studentid + " and Name like '" + Name + "'");
if (dt.Rows.Count != 0)//已提交过教师指导记录表, 则可下载
{
string filepath = Server.MapPath("~/" + dt.Rows[0].ItemArray[4].ToString());
Response.Clear();
Response.Buffer = true;
this.EnableViewState = false;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Disposition", "attachment;filename=download.doc");
Response.ContentType = "application/ms-word";
Response.WriteFile(filepath);
Response.Flush();
Response.Close();
Response.End();
}
else
{
Response.Write("文件不存在!");
Response.Flush();
Response.Close();
Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -