• asp.net页面缓存学习


      一个小练习,学习缓存,在页面建一个按键,打印出当前时间,

    在页面加上

    <%@ OutputCache  Duration="15"  VaryByParam ="none" %>这行代码,
    Duration是注明缓存页面的时间,15秒,VarByParam="none",这行代码的意思是,缓存不加任何条件,这样页面,在15秒内就不会再提交了!
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm8.aspx.cs" Inherits="WebApplication1.WebForm8" %>
    <%@ OutputCache  Duration="15"  VaryByParam ="none" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label> 
            <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        </div>
        </form>
    </body>
    </html>

    后台代码

    public partial class WebForm8 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
            protected void Button1_Click(object sender, EventArgs e)
            {
                DateTime  datetime = DateTime.Now;
    
                Label1.Text = datetime.ToString();
            }
        }

    缓存今天就学到这里,有时间再学吧

  • 相关阅读:
    Python基础语法
    理解session和cookie
    应用服务器
    web服务器
    Python正则表达式
    理解HTTP协议
    常见浏览器内核
    python中range()和len()函数区别
    多线程执行测试用例
    selenium+Python(生成html测试报告)
  • 原文地址:https://www.cnblogs.com/xu3593/p/2965207.html
Copyright © 2020-2023  润新知