Advertisement
MarMar_IV

Untitled

Dec 14th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. /// HANDLER
  2. /// HANDLER
  3. /// HANDLER
  4. /// HANDLER
  5. /// HANDLER
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Drawing;
  9. using System.Drawing.Imaging;
  10. using System.Linq;
  11. using System.Web;
  12.  
  13. namespace WebApplication3
  14. {
  15. /// <summary>
  16. /// Summary description for Handler1
  17. /// </summary>
  18. public class Handler1 : IHttpHandler
  19. {
  20.  
  21. public void ProcessRequest(HttpContext context)
  22. {
  23. String dta = context.Request.QueryString["data"];
  24.  
  25. context.Response.ContentType = "image/jpg";
  26. Bitmap b = new Bitmap(context.Server.MapPath("~/App_Data/"+dta+".jpg"));
  27. b.Save(context.Response.OutputStream, ImageFormat.Jpeg);
  28. }
  29.  
  30. public bool IsReusable
  31. {
  32. get
  33. {
  34. return false;
  35. }
  36. }
  37. }
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. /// PAGE - LAYOUT
  53. /// PAGE - LAYOUT
  54. /// PAGE - LAYOUT
  55. /// PAGE - LAYOUT
  56. /// PAGE - LAYOUT
  57. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="WebApplication3._default" %>
  58.  
  59. <!DOCTYPE html>
  60.  
  61. <html xmlns="http://www.w3.org/1999/xhtml">
  62. <head runat="server">
  63. <title></title>
  64. </head>
  65. <body>
  66. <form id="form1" runat="server">
  67. <div>
  68. <img src="Handler1.ashx?data=<%= prms %>">
  69. </div>
  70. </form>
  71. </body>
  72. </html>
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. /// PAGE
  80. /// PAGE
  81. /// PAGE
  82. /// PAGE
  83. /// PAGE
  84. using System;
  85. using System.Collections.Generic;
  86. using System.Linq;
  87. using System.Web;
  88. using System.Web.UI;
  89. using System.Web.UI.WebControls;
  90.  
  91. namespace WebApplication3
  92. {
  93. public partial class _default : System.Web.UI.Page
  94. {
  95. public String prms = "asd";
  96. protected void Page_Load(object sender, EventArgs e)
  97. {
  98.  
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement