BUG: Cached HTC files generate unnecessary GET requests (319176)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5
  • Microsoft Internet Explorer (Programming) 6.0

This article was previously published under Q319176

SYMPTOMS

After a Hypertext Markup Language (HTML) Component (HTC) file has been cached on a client computer, requests after that to use the file may result in an unnecessary extra If-Modified-Since GET request to the server even though the file has not expired.

RESOLUTION

Avoid this problem by setting a content expiration header on the Web server for each of the .htc files that are requested. For example, one workaround would be to set the expiration on the .htc content to 1 day. By default, the expiration is 1 day in Microsoft Internet Information Services.

Client-side fix for Microsoft Internet Explorer 6

For more information about a client-side hotfix for Internet Explorer 6, click the following article number to view the article in the Microsoft Knowledge Base:

840312 Cached HTC files generate additional GET requests in Internet Explorer 6

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create an Active Server Pages (ASP) file that returns an HTML page. The HTML page must contain an HTC file, a Graphics Interchange Format (GIF) file or Joint Photographic Experts Group (JPEG) file, and a Microsoft JScript file. For the GIF file or the JPEG file, you can copy either of these files from any Web site and rename the files to Test.gif or to Test.jpg, respectively. Code for the various files follows: Test.asp:
    <html>
    <head>
    <style>
      DIV { behavior:url(test.htc) }
    </style>
    </head>
    <body>
    <script language="javascript" src="test.js"></script>
    <br>
    <div>Hover over me to see behavior in action</div>
    </body>
    </html>
    					

    Test.htc:
    <public:component>
    <public:attach event="onmouseover" onevent="Hilite()" />
    <public:attach event="onmouseout" onevent="Restore()" />
      <script language="JScript">
      var normalColor, normalSpacing;
    
      function Hilite()
      {
        // save original values
        normalColor = runtimeStyle.color;
        normalSpacing = runtimeStyle.letterSpacing;
    
        runtimeStyle.color = "red";  // same as element.runtimeStyle.color
        runtimeStyle.letterSpacing = 2;
      }
    
      function Restore()
      {
        // restore original values
        runtimeStyle.color = normalColor;
        runtimeStyle.letterSpacing = normalSpacing;
      }
      </script>
    </public:component>
    					
    Test.js:
    function Test()
    {
    	alert("test");
    }
    					
  2. Create an HTML page to perform a POST request to the ASP file that you generated in step 1. Test.htm
    <html>
    <body>
    <form method="POST" action="test.asp">
    	<input name="name">
    <input type="submit">
    </form>
    </body>
    </html>
    					
  3. Place all of the files in the same directory on a Web server.
  4. Start Internet Explorer and browse to Test.htm.
  5. Click Submit to perform a POST request to the ASP file. The ASP file returns an HTML page.

  6. After the HTML page appears with the HTC file, the GIF file, and the JScript file, click Back and perform this sequence again. As you follow these steps, you can observe that Internet Explorer repeatedly makes a GET request with the If-Modified-Since header only for the HTC file. You can observe this either by using a network monitoring tool such as NetMon, or you can check the Last Checked column in the Temporary Internet Files folder.

  7. To open the Temporary Internet Files folder, from the Internet Explorer Tools menu, click Internet Options, click the General tab, click Settings, and then click View Files.

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

293099 BUG: Cached XML files generate unnecessary GET requests


Modification Type:MajorLast Reviewed:7/18/2005
Keywords:kbbug kbpending KB319176