ASP Code
  Home arrow ASP Code arrow Good caching procedure (HTML and images) b...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

Good caching procedure (HTML and images) by Gregory S
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2000-06-10

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    A brief explaination of good caching procedure by ASP contributor - Gregory S.

    Good caching procedure (HTML and images)

    I've been interested for a long time how IE handles cache and how browser decides wether to bring image from cache or fetch it from server. So I got Network Monitor (part of SMS 2.0) to catch all communications between browser and server and started experimenting with IE. After hour of digging into documentation for IE I found out that prior to ver 4.0 there were no such thing as "cached object", by default (if server does not send any special HTTP headers) - IE always contacts server to check if updated version of product is available.
    (Standard installation of IIS and no special HTTP headers sent ):
    1. If this is first query to server then GET requests is look like
    this . As a response to query server sends back  resource.

    Please pay attention to Last Modified header which corresponds to respective OS file property. This value take a big role in all consequetive requests which are sent to server.

    2. All subsequentive requests to resource are a little bit different. The
    query  itself has  an additional header now (If-Modified-Since) which is equal to the value which was received by browser in previous communication. Response from server is very much different from mentioned above. If the file was not modified since the time which was received by server from browser - server returns code 0x0130 which tells browser that there is no updated version available and it can bring resource from cache.

    With above mentioned solution there are a couple of obvious disadvantages. First there would be always delay which would be required to establish TCP/IP connection, then to send query, then to receive response. Also it places additional load on bandwidth of both client and server and could be significant in case of SSL and modem connections. So that's why there are additional headers which are available to modify that behavior (look below)

    That's how modified communications are look like (IIS is tuned to send Expires header):

    1. If this is first query to server then GET requests is look like
    this . As a response to query server sends back  resource.

    Please pay attention that along with standard Last Modified header which was used in first case there are now 2 more headers (Expires and Cache-Control). Frankly speaking I still don't understand why browser needs both of them but based on values of this headers - browser stamps resource with expiration date and outs it into cache. In the above mentioned example cache time value is 432000 s which corresponds to 5 days. This information is used by server in all subsequent requests to servers.

    2. All next requests to server - IE just checks whether content in cache was expired or not and respectively does not make any trip to server for resource at all.


    This method is extremely helpful on homepages of companies which usually does not change as frequently as other pages and so can be cached on client side.

    If you have questions are any additions (especially if you know why browser needs both Expires and Content-Control:max-age) then please email.


    P.S. Below is very nasty problem which I have faced when was implementing method on a cluster of Web servers. Please read information below because there is a chance that you can face the same problem. The problem was as follows: I was managing a cluster of 3 web servers and this configuration was working fine on server no.1 but not 2 or 3. Machines were identical and I have spent several hours digging registry and metabase for possible solutions. Network Monitor helped me again in this situation - look  what I found out while catching problems with faulty servers. If you can see there is incorrect value sent in cache-control value which is for some reason set to 0 instead of supposed 432000. Why that was happening I still don't understand but I tried the most simple solution and to my surprised it worked. I added additional header with the same name, so response become look like this. It fixed the problem and browser have given precedence to the maximum value, after that all of servers become working fine.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Applying lean thinking to the governance of software development

    Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations.
    FREE! Go There Now!


    NEW! Download DB2 Express-C 9.5

    Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Software Analyzer V7.0

    Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle.
    FREE! Go There Now!


    NEW! Try IBM Rational Asset Manager V7.0 online!

    You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Process

    Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!


    NEW! Webcast: Extreme transaction processing with WebSphere Extended Deployment

    In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Whitepaper: Achieving consistency between business process models and operational guides

    Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT