Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You described dynamically generating images in your Page_Load event which suggests that your images are being served by an ASP.NET page. If you are not serving pages, then there is no need to incur the performance overhead of instantiating the page object and it's associated objects, lifecycle events etc.</p> <p>A better 'or more proper' way of generating your images would be to serve them from within a lighter HttpHandler (but you can still use Bitmap just fine). To implement the <a href="http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.aspx" rel="nofollow">IHttpHandler interface</a> you only have to implement 2 methods and there's not much to it. Something like this:</p> <pre><code>&lt;%@ WebHandler Language="C#" Class="ImageHandler" %&gt; using System; using System.IO; using System.Web; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; public class ImageHandler : IHttpHandler { public void ProcessRequest (HttpContext context) { Bitmap output = new Bitmap(path); // Do lots of fun stuff here related to image // manipulation and/or generation ... context.Response.ContentType = ResponseType("Image/png"); // Send image to the browser image.Save(context.Response.OutputStream, ImageType(path)); // Be careful to clean up; you could put this inside a 'using' block image.Dispose(); } public bool IsReusable { get { return true; } } } </code></pre> <p>Please note: <strong>This is not working code</strong>... just a little example to give you an idea.</p> <p>Put your code in an HttpHandler and you'll be 50% closer to awesome. At any rate, it will certainly serve your images faster and allow you to handle more requests... plus you get to learn more of the framework ;-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload