Microsoft KB Archive/319176

= BUG: Cached HTC files generate unnecessary GET requests =

Article ID: 319176

Article Last Modified on 7/18/2005

-

APPLIES TO


 * Microsoft Internet Explorer 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 &quot;Applies to&quot; section.



Steps to Reproduce the Behavior
  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:

DIV { behavior:url(test.htc) }  Hover over me to see behavior in action

Test.htc:

    var normalColor, normalSpacing;

function Hilite {   // save original values normalColor = runtimeStyle.color; normalSpacing = runtimeStyle.letterSpacing;

runtimeStyle.color = &quot;red&quot;; // same as element.runtimeStyle.color runtimeStyle.letterSpacing = 2; }

function Restore {   // restore original values runtimeStyle.color = normalColor; runtimeStyle.letterSpacing = normalSpacing; }  Test.js:

function Test {   alert(&quot;test&quot;); }                     Create an HTML page to perform a POST request to the ASP file that you generated in step 1. Test.htm

 <input name=&quot;name&quot;> <input type=&quot;submit&quot;> </li> Place all of the files in the same directory on a Web server.</li> Start Internet Explorer and browse to Test.htm.</li> Click Submit to perform a POST request to the ASP file. The ASP file returns an HTML page.

</li> 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.

</li> 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.</li></ol>

<div class="references_section">