<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gudubeth &#187; asp.net</title>
	<atom:link href="http://www.gudubeth.net/en/tag/asp-net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gudubeth.net/en</link>
	<description>A blog about web design and programming - php, actionscript, javascript, java, css</description>
	<lastBuildDate>Tue, 27 Apr 2010 19:08:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Disabling browser caching</title>
		<link>http://www.gudubeth.net/en/articles/disabling-browser-caching</link>
		<comments>http://www.gudubeth.net/en/articles/disabling-browser-caching#comments</comments>
		<pubDate>Sun, 03 Jan 2010 20:53:50 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=56</guid>
		<description><![CDATA[There are two basic ways of disabling browsers to cache your web page. You can add related meta tags inside the head part of html or add response headers to page at the server side if you are using server side programming languages like PHP, Java/JSP or ASP.NET. 
1. Disabling browser caching inside HTML
&#60;meta http-equiv=&#8221;Pragma&#8221; [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>There are two basic ways of disabling browsers to cache your web page. You can add related meta tags inside the head part of html or add response headers to page at the server side if you are using server side programming languages like PHP, Java/JSP or ASP.NET. </p>
<h3>1. Disabling browser caching inside HTML</h3>
<p>&lt;meta http-equiv=&#8221;Pragma&#8221; content=&#8221;No-Cache&#8221; /&gt;<br />
&lt;meta http-equiv=&#8221;cache-control&#8221; content=&#8221;no-cache, no store&#8221; /&gt;<br />
&lt;meta name=&#8221;Expires&#8221; content=&#8221;Mon, 26 Jul 1997 05:00:00 GMT&#8221; /&gt;</p>
<p>Add the code above inside &lt;head&gt;&lt;/head&gt; tags of your page. The main disadvantage of this technique is that you can&#8217;t use inside non-html pages like XML or RSS.</p>
<h3>2. Disabling the browser from caching at the server side</h3>
<p>To prevent caching you have to add some headers to response. You can find code samples for PHP, ASP.NET and Java/JSP above. You can add these header to any kind of pages / files.</p>
<p><strong>PHP</strong></p>
<pre lang="php"> header("Expires: Mon, 01 Jul 1990 05:00:00 GMT");
 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 header("Cache-Control: no-store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");</pre>
<p><strong>ASP.NET</strong></p>
<pre lang="java">Response.ClearHeaders();
Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0
Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // HTTP 1.0</pre>
<p>I found this ASP.NET code at Stackoverflow: <a href="http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers" target="_blank">Making Sure a Web Page is not Cached Across All Browsers</a>. I hope it works (:</p>
<p><strong>Java</strong></p>
<pre lang="java">response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1); //proxy level cache disabling</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/disabling-browser-caching/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
