Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET_SessionId cookie slows down web server on multiple GET requests
    primarykey
    data
    text
    <p>I am testing my ASP.NET MVC2 web application using MS VisualStudio 2010 Express and the ASP.NET Development server on <a href="http://localhost" rel="nofollow">http://localhost</a>. The ASP.NET Framework is version 4.</p> <p>I have a page with a list of images that are retrieved through an Action method as follows:</p> <p>[HTML code]</p> <pre><code>&lt;img src="/images/thumb_79c7b9f0-5939-43e5-a6d0-d5e43f4e8947.jpg" alt="image"&gt; </code></pre> <p>[Routing configuration in Global.asax.cs]</p> <pre><code>public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( "Image", "images/{id}", new { controller = "Image", action = "Picture", id = "" } ); // [...] other routing settings } } </code></pre> <p>[Image Controller]</p> <pre><code>public class ImageController : Controller { [AcceptVerbs(HttpVerbs.Get)] public ActionResult Picture(string id) { try { return File(ImageBasePath + id, "image/jpeg"); } catch (Exception) { } } private string ImageBasePath { get { return HttpContext.Request.PhysicalApplicationPath + WebConfigurationManager.AppSettings["dbImageBasePath"]; } } } </code></pre> <p>In practice, the Picture action method performs other checks before returning the image and this is the reason why I return the image through an action method.</p> <p>The problem here is that when there is no session in place (i.e. the ASP.NET_SessionId cookie doesn't exist for localhost) the time for the browser to get the images is very short (~10ms) while when ASP.NET_SessionId cookie does exist, the time jumps to 500ms-1s. This happens on any browser.</p> <p>I've done various tests and I saw that if I get the images without passing through the ASP.NET application, the ASP.NET_SessionId cookie doesn't affect the loading time.</p> <p>It looks like multiple HTTP GET requests with an ASP.NET_SessionId cookie passed to the web application slow down considerably the application itself.</p> <p>Does anyone have an explanation for such a strange behavior?</p> <p>Many thanks.</p> <p>UPDATE The problem described above occurs on a IIS7 web server as well, so it is not specific to the local ASP.NET Development server.</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.
 

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