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! Application Development Tools for the Mainframe Developer

    You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Discovering the value of 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! 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! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Trial download: IBM Lotus Forms V3.0

    Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Functional Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications.
    FREE! Go There Now!


    NEW! Webcast: What is new in Viper 2 for developers?

    Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications.
    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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek