<?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: Web Tasarım, Programlama &#187; asp.net</title>
	<atom:link href="http://www.gudubeth.net/tr/etiket/asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gudubeth.net/tr</link>
	<description>Web tasarım ve programlama (php, javascript, actionscript, java, css) blog&#039;u</description>
	<lastBuildDate>Mon, 03 May 2010 19:21:33 +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>Sayfanın cache&#8217;lenmesini engelleme</title>
		<link>http://www.gudubeth.net/tr/yazi/sayfanin-cachelenmesini-engelleme/</link>
		<comments>http://www.gudubeth.net/tr/yazi/sayfanin-cachelenmesini-engelleme/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 14:03:59 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Programlama]]></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/tr/?p=127</guid>
		<description><![CDATA[Web sitesi hazırlarken sayfalarınızın tarayıcı önbelleğine alınmasını (yani cache&#8217;lenmesini) engellemenin iki temel yolu var. Birincisi HTML içerisinde meta etiketleri yazmak, ikincisi sunucu tarafında sayfanın başlığına (header) gerekli satırları eklemek. Aşağıda bu iki yöntemi bulacaksınız.
1. HTML ile sayfanızın önbelleğe alınmasını engelleme
&#60;meta http-equiv=&#8221;Pragma&#8221; content=&#8221;No-Cache&#8221; /&#62;
&#60;meta http-equiv=&#8221;cache-control&#8221; content=&#8221;no-cache, no store&#8221; /&#62;
&#60;meta name=&#8221;Expires&#8221; content=&#8221;Mon, 26 Jul 1997 05:00:00 GMT&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Web sitesi hazırlarken sayfalarınızın tarayıcı önbelleğine alınmasını (yani cache&#8217;lenmesini) engellemenin iki temel yolu var. Birincisi HTML içerisinde meta etiketleri yazmak, ikincisi sunucu tarafında sayfanın başlığına (header) gerekli satırları eklemek. Aşağıda bu iki yöntemi bulacaksınız.</p>
<h3>1. HTML ile sayfanızın önbelleğe alınmasını engelleme</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>Yukarıdaki kodu sayfanızda &lt;head&gt;&lt;/head&gt; etiketleri arasında yerleştirmelisiniz. Bu yöntemin dezavantajı XML ya da RSS gibi HTML olmayan sayfalarda kullanılamayacak olmasıdır.</p>
<h3>2. Sunucu tarafında engelleme</h3>
<p>Ön belleğe alma işlemini sunucu tarafında engellemek için,  göndereceğimiz sayfa ile birlikte bazı başlıkları (header) göndermemiz gerekiyor. PHP, ASP.NET ve JAVA/JSP için bu başlıkların nasıl yazılacağını aşağıda bulabilirsiniz. Birinci yöntemden farklı olarak bu başlıkları resimlerde dahil olmak üzere her türlü dosyayı gönderirken kullanabilirsiniz.</p>
<p><strong>PHP</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires: Mon, 01 Jul 1990 05:00:00 GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Last-Modified: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">gmdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;D, d M Y H:i:s&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: no-store, no-cache, must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: post-check=0, pre-check=0&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma: no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>ASP.NET</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Response.<span style="color: #006633;">ClearHeaders</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;private&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;no-store&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;max-stale=0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;post-check=0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>, <span style="color: #0000ff;">&quot;pre-check=0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.1</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma&quot;</span>, <span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.0</span>
Response.<span style="color: #006633;">AppendHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires&quot;</span>, <span style="color: #0000ff;">&quot;Mon, 26 Jul 1997 05:00:00 GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP 1.0</span></pre></div></div>

<p>Yukarıdaki ASP.NET kodunu  Stackoverflow&#8217;da şu sayfada buldum: <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>. Denemiş değilim ama muhtemelen doğru çalışıyordur.</p>
<p><strong>Java</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>,<span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//HTTP 1.1</span>
response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma&quot;</span>,<span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//HTTP 1.0</span>
response.<span style="color: #006633;">setDateHeader</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires&quot;</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//proxy seviyesinde engelleme</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/tr/yazi/sayfanin-cachelenmesini-engelleme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
