You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.4 KiB

<%@ WebHandler Language="C#" Class="GetImg" %>
using System;
using System.Web;
using OT.Web.Ap_Code;
public class GetImg : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string gu_id = context.Request["F"];
string strImgsrc = "";
string subFileName = "";
try
{
if (!string.IsNullOrEmpty(gu_id)) //不為空
{
OT.BLL.OTB_SYS_Document otb_document_bll = new OT.BLL.OTB_SYS_Document();
OT.Model.OTB_SYS_Document otb_document_model = new OT.Model.OTB_SYS_Document();
otb_document_model = otb_document_bll.GetImgSrc(gu_id); //代入GUID傳回Src
strImgsrc = otb_document_model.FilePath == null ? "" : otb_document_model.FilePath;
subFileName = otb_document_model.SubFileName == null ? "jpeg" : otb_document_model.SubFileName.Substring(1);
}
HttpResponse txt = context.Response;
txt.ContentType = "image/" + subFileName;
txt.WriteFile(strImgsrc);
//context.Response.Write(strImgsrc);
//context.Response.Write("Hello World");
}
catch (Exception ex)
{
BasePage.mo_Log.Error("TvlGetImg.ashx Error Message:" + ex.Message + "\nGUID:" + gu_id + "\nFilePath:" + strImgsrc);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}