64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Configuration;
|
|||
|
|
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 WeiSha.Common;
|
|||
|
|
|
|||
|
|
using Song.ServiceInterfaces;
|
|||
|
|
using Song.Entities;
|
|||
|
|
|
|||
|
|
namespace Song.Site.Manage.Content
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>¼<EFBFBD><C2BC><EFBFBD>صĴ<D8B5><C4B4><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class LoadNumber : IHttpHandler
|
|||
|
|
{
|
|||
|
|
#region IHttpHandler <EFBFBD><EFBFBD>Ա
|
|||
|
|
|
|||
|
|
public void ProcessRequest(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string filePath = context.Request.FilePath;
|
|||
|
|
if (filePath.IndexOf(".") > -1)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ͼƬlogo<67><6F>
|
|||
|
|
if (filePath.Substring(filePath.LastIndexOf(".") + 1).ToLower() == "jpg")
|
|||
|
|
{
|
|||
|
|
context.Response.WriteFile(context.Request.FilePath);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>һ
|
|||
|
|
string file = filePath.Substring(filePath.LastIndexOf("/") + 1);
|
|||
|
|
Business.Do<IContents>().DownloadNumber(file, 1);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
context.Response.Clear();
|
|||
|
|
context.Response.ClearContent();
|
|||
|
|
context.Response.ClearHeaders();
|
|||
|
|
context.Response.AddHeader("Content-Disposition", "attachment;filename=" + file);
|
|||
|
|
System.IO.FileInfo fi = new System.IO.FileInfo(context.Server.MapPath(filePath));
|
|||
|
|
context.Response.AddHeader("Content-Length", fi.Length.ToString());
|
|||
|
|
context.Response.AddHeader("Content-Transfer-Encoding", "binary");
|
|||
|
|
context.Response.ContentType = "application/octet-stream";
|
|||
|
|
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|||
|
|
context.Response.WriteFile(filePath);
|
|||
|
|
context.Response.Flush();
|
|||
|
|
context.Response.End();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool IsReusable
|
|||
|
|
{
|
|||
|
|
get { return true; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|