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.5 KiB

  1. using Swift.web.Library;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Web;
  7. namespace Swift.web.AgentNew
  8. {
  9. /// <summary>
  10. /// Summary description for GetIdPictureView
  11. /// </summary>
  12. public class GetIdPictureView : IHttpHandler
  13. {
  14. public void ProcessRequest(HttpContext context)
  15. {
  16. var imageName = context.Request.QueryString["fileName"];
  17. var imgPath = GetStatic.GetAppRoot() + @"\Images\na.gif";
  18. if (imageName == "" || imageName == null || imageName.Split('_').Length < 3)
  19. {
  20. context.Response.WriteFile(imgPath);
  21. }
  22. else
  23. {
  24. var fileName = context.Request.QueryString["fileName"];
  25. var user = context.Request.QueryString["createdBy"];
  26. imgPath = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + "ID Collection\\" + user +"\\"+ fileName;
  27. if (File.Exists(imgPath))
  28. {
  29. context.Response.ContentType = imgPath;
  30. }
  31. else
  32. {
  33. context.Response.ContentType = GetStatic.ReadWebConfig("root", "") + "Images\\na.gif";
  34. }
  35. }
  36. context.Response.WriteFile(context.Response.ContentType);
  37. }
  38. public bool IsReusable
  39. {
  40. get
  41. {
  42. return false;
  43. }
  44. }
  45. }
  46. }