call aspx page to return an image randomly slow

Because you use .aspx page (and not handler), and because the images loaded by browser not one by one, but many together, I suspect that you felt on the session lock of the page and that’s why this delay.

Try to set EnableSessionState="false" on the page.

eg:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" 
    AutoEventWireup="false" Inherits="WebApplication1.WebForm1" 
     EnableSessionState="false" %>

By the way, if you change the aspx page to a handler page you going to gain some more speed because the handler page did not make all the calls that a normally page do.

Leave a Comment