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.
 
 
 
 
 

49 lines
1.7 KiB

using Swift.web.Library;
using System.IO;
using System.Web;
namespace Swift.web.AgentNew
{
/// <summary>
/// Summary description for GetFileView
/// </summary>
public class GetFileView : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var imageName = context.Request.QueryString["imageName"];
var imgPath = GetStatic.GetAppRoot() + @"\Images\na.gif";
if (imageName == "" || imageName == null || imageName.Split('_').Length < 6)
{
context.Response.WriteFile(imgPath);
}
else
{
var customerId = context.Request.QueryString["customerId"];
var dirLocation = imageName.Split('_')[3].ToString() + "\\" + imageName.Split('_')[4].ToString() + "\\" + imageName.Split('_')[5].Split('.')[0].ToString() + "\\";
var fileType = context.Request.QueryString["fileType"];
var file = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + dirLocation + customerId + "\\" + imageName;
bool a = fileType.Contains("image");
System.Diagnostics.Debug.WriteLine("SomeText");
if (File.Exists(file) && a)
{
imgPath = file;
context.Response.ContentType = fileType;
}
else
{
context.Response.ContentType = fileType;
}
}
context.Response.WriteFile(imgPath);
}
public bool IsReusable
{
get
{
return false;
}
}
}
}