HttpCachePolicy.SetNoStore メソッド
アセンブリ: System.Web (system.web.dll 内)


HttpCachePolicy クラスの SetNoStore メソッドを使用して、応答を履歴に格納しないようクライアントに指示する方法を次のコード例に示します。
<%@ Page language="VB" AutoEventWireup="true" %> <HTML> <HEAD> <title>HttpCachePolicy - SetNoStore - Visual Basic .NET Example</title> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Prevent the browser from caching the ASPX page. Response.Cache.SetNoStore() ' Display the DateTime value. Label1.Text = DateTime.Now.ToLongTimeString() End Sub </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>HttpCachePolicy - SetNoStore - Visual Basic .NET Example</h3> <P>Click the Submit button a few times, and then click the Browser's Back button.<BR> You should get a "Warning: Page has Expired" error message.</P> <P>Time: <asp:Label id="Label1" runat="server" Font-Bold="True" ForeColor="Red" /></P> <asp:Button id="Button1" runat="server" Text="Submit" /> </form> </body> </HTML>
<%@ Page language="c#" AutoEventWireup="true" %> <HTML> <HEAD> <title>HttpCachePolicy - SetNoStore - C# Example</title> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Prevent the browser from caching the ASPX page Response.Cache.SetNoStore(); // Display the DateTime value. Label1.Text = DateTime.Now.ToLongTimeString(); } </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>HttpCachePolicy - SetNoStore - C# Example</h3> <P>Click the Submit button a few times, and then click the Browser's Back button.<BR> You should get a "Warning: Page has Expired" error message.</P> <P>Time: <asp:Label id="Label1" runat="server" Font-Bold="True" ForeColor="Red" /></P> <asp:Button id="Button1" runat="server" Text="Submit" /> </form> </body> </HTML>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HttpCachePolicy.SetNoStore メソッドのページへのリンク