zoukankan      html  css  js  c++  java
  • 我的静态页面

     protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                DateTime dt = System.IO.File.GetLastWriteTime("index.html");
                TimeSpan ts = dt - DateTime.Now;
                if (ts.TotalHours > 1)
                {
                    System.IO.StringWriter html = new System.IO.StringWriter();
                    System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
                    base.Render(tw);
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.UTF8);
                    sw.Write(html.ToString());
                    sw.Close();
                    tw.Close();
                    Response.Redirect("Index.html");
                }
                else
                {
                    Response.Redirect("Index.html");
                }
            }
            catch
            {
                System.IO.StringWriter html = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
                base.Render(tw);
                System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.UTF8);
                sw.Write(html.ToString());
                sw.Close();
                tw.Close();
                Response.Redirect("Index.html");
            }
           
        }
  • 相关阅读:
    python数据类型
    集合(set)内置方法
    python第三天
    剑指offer-什么是1G/2G/3G/4G/5G
    经典交换实验-二层交换机实现pc隔离&vlan通信
    linux运维神器-htop&mtr
    三分钟速学linux-进程管理命令
    三分钟速学文件权限管理
    三分钟速学网卡管理配置-nmcli命令
    三分钟速学linux-centos/redhat常见包管理器
  • 原文地址:https://www.cnblogs.com/future/p/1206275.html
Copyright © 2011-2022 走看看