using Swift.web.Library; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; namespace Swift.web.AgentNew { /// /// Summary description for GetFileViewNew /// public class GetFileViewNew : IHttpHandler { public void ProcessRequest(HttpContext context) { var imageName = context.Request.QueryString["fileName"]; var imgPath = GetStatic.GetAppRoot() + @"\Images\na.gif"; if (imageName == "" || imageName == null || imageName.Split('_').Length < 6) { context.Response.WriteFile(imgPath); } else { var registerDate = context.Request.QueryString["registerDate"]; var customerId = context.Request.QueryString["customerId"]; var membershipNo = context.Request.QueryString["membershipNo"]; var fileName = context.Request.QueryString["fileName"]; DateTime txnDate = Convert.ToDateTime(registerDate); //imgPath = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipNo + "\\" + fileName; imgPath = Path.Combine(GetStatic.GetCustomerFilePath(), "CustomerDocument", registerDate.Replace("-", "/"), membershipNo, fileName); if (File.Exists(imgPath)) { context.Response.ContentType = imgPath; } else { context.Response.ContentType = GetStatic.ReadWebConfig("root", "") + "Images\\na.gif"; } } context.Response.WriteFile(context.Response.ContentType); } public bool IsReusable { get { return false; } } } }