Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
XML
<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

XML
<%@ 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

1 solution

Try this link
Caching Images in ASP.NET[^]

Hope this helps
 
Share this answer
 
Comments
vishal.shimpi 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900