Microsoft KB Archive/172896

= PRB: Browser Does Not Display Most Recent Versions of HTM or ASP Files =

Article ID: 172896

Article Last Modified on 5/2/2006

-

APPLIES TO


 * Microsoft Visual InterDev 1.0 Standard Edition

-



This article was previously published under Q172896



SYMPTOMS
When you use the Preview in Browser command on an .asp or .htm file, an older version of the file is displayed, and the changes that you made appear to be lost.



CAUSE
This is caused by the cache settings in the browser or the proxy server. If the browser is set to look only for cached versions, or if the proxy server is set to cache files, the updated files are not be displayed.



RESOLUTION
To work around this problem, use one of the following methods:  From the user side, change the cache settings of the browser as follows:  On the Tools menu, click Internet Options. In the Temporary Internet Files section, click Settings. Click any option other than Never. The page should then display correctly.   From the server side, include the following line: <% Response.Expires = 0 %> at the top of the page in .asp files. This prevents any browser from displaying the cached version of the file. Note that this only works for .asp files. </li>  If there is a difference between the client and server time where the client time is earlier than the server time, use the following line: <% Response.ExpiresAbsolute = [date] [time] %> instead of: <% Response.Expires = 0 %> to indicate immediate expiration of the page. </li>  If you are working through a proxy server, the following lines should keep most proxy servers from caching the page: <% Response.AddHeader "cache-control", "private" %> <% Response.AddHeader "pragma", "no-cache" %> </li></ul>

NOTE: An important caveat is that Internet Explorer does not look for a new version if the same file that is requested through Visual InterDev's Preview in Browser is the file that is currently displayed in the browser's window. Internet Explorer takes focus but does not look for a more recent version no matter what the cache settings are. Using the browser's Refresh button gets the new contents.

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
To reproduce this problem, preview an .asp or .htm file that has just been changed. The changes do not appear in the browser if the file is cached somewhere.

<div class="references_section">