Web/shop/download.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#region license
/**********************************************
* CopyRight (c) 2009-2010 HangJing Teconology. All Rights Re* Function :
* at 2011-7-14 15:55:40.
* E-Mail: jijunjian@iWMPT.com
*********************************************** */
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WMPT.SQLServerDAL;
using WMPT.Common;
using WMPT.Model;
using System.IO;
public partial class Admin_shop_download : System.Web.UI.Page
{
FileInfo fileInfo = null;
protected void Page_Load(object sender, EventArgs e)
{
// WebUtility.getFile(Server.MapPath("~/shop/foodupload.rar"));
DownloadFile(Server.MapPath("~/shop/foodupload.rar"), "foodupload.rar");
}
/// <summary>
/// 文件下载
/// </summary>
/// <param name="fullName">文件完整路径</param>
/// <param name="sendFileName">发送到客户端显示的文件名</param>
/// <returns>下载成功返回true,否则返回false</returns>
public bool DownloadFile(string fullName, string sendFileName)
{
if (!IsFileExists(fullName))
return false;
try
{
fileInfo = new FileInfo(fullName);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(sendFileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fileInfo.FullName);
Response.End();
Response.Flush();
Response.Clear();
return true;
}
catch (Exception ex)
{
throw ex;
}
}
public bool IsFileExists(string fullName)
{
后面还有 6 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
