Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
How do i cache all images in my website to client machine and how do i cross check performance of my web site? i have search a lot and i have created handler also but i am not able to find out whether it is write or wrong. following are code chunk which i have done in my application...
 
i have used "SoftwareArchitects.dll" file, which i download from code project.
 
The things i added in Config file..
<configuration>
  <configSections>
    <!-- software architects - CachingHandler -->
    <sectionGroup name="SoftwareArchitects">
      <section name="Caching" requirePermission="false" type="SoftwareArchitects.Web.Configuration.CachingSection, SoftwareArchitects.Web.CachingHandler"/>
    </sectionGroup>
  </configSections>
 
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <trace enabled="true" pageOutput="false" requestLimit="50" mostRecent="true"/>
    <httpHandlers>
      <!-- software architects - CachingHandler -->
      <add verb="*" path="*.gif.ashx" type="SoftwareArchitects.Web.CachingHandler, SoftwareArchitects.Web.CachingHandler"/>
      <add verb="*" path="*.jpg.ashx" type="SoftwareArchitects.Web.CachingHandler, SoftwareArchitects.Web.CachingHandler"/>
      <add verb="*" path="*.png.ashx" type="SoftwareArchitects.Web.CachingHandler, SoftwareArchitects.Web.CachingHandler"/>
    </httpHandlers>
  </system.web>
 
  <SoftwareArchitects>
    <Caching CachingTimeSpan="1">
      <FileExtensions>
        <clear/>
        <add Extension="gif" ContentType="image\gif"/>
        <add Extension="jpg" ContentType="image\jpeg"/>
        <add Extension="png" ContentType="image\png"/>
      </FileExtensions>
    </Caching>
  </SoftwareArchitects>
 
</configuration>
 
Following is my default.aspx file
 
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="ImageCaching._Default" %>
 
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Image Caching Sample
    </h2>
    <p>
        <img src="Images/1.png.ashx" />
        <asp:Button ID="btn" runat="server" />
    </p>
 
</asp:Content>
 
Everything is working fine but i can not calculate the speed defference. i used trace.axd also but every time the trace is same....
Posted 31-Jan-13 19:18pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try this link
Caching Images in ASP.NET[^]
 
Hope this helps
  Permalink  
Comments
vishal.shimpi at 1-Feb-13 1:02am
   
I tried with this same link that u suggested, but still the problem is that at first load my trace is of 50 line when i click on any button or refresh page after that again the trace is 50..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 George Jonsson 145
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100