-
ASP.NET 中如何对生成的 HTML 内容流进行控制
- 转自:blog.csdn.net/net_lover/archive/2010/02/25/5324455.aspx
- <%@ Page Language="C#" %>
- <%@ Import Namespace="System.IO" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <script runat="server">
- protected override void Render(HtmlTextWriter writer)
- {
- string content = string.Empty;
- StringWriter stringWriter = new StringWriter();
- HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
- try
- {
-
- base.Render(htmlWriter);
- htmlWriter.Close();
-
- content = stringWriter.ToString();
-
- string newContent = content.Replace("[mxh]", "孟宪会");
-
- writer.Write(newContent);
- }
- catch { }
- finally
- {
- stringWriter.Dispose();
- htmlWriter.Close();
- htmlWriter.Dispose();
- }
- }
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>孟宪会之替换页面呈现内容测试</title>
- </head>
- <body>
- <form id="form1" runat="server">
- [mxh]
- </form>
- </body>
- </html>
-
相关阅读:
【XSY2505】tree
【XSY2558】圆上的蚂蚁 Ants on circle
【模板】生成函数
左偏树
Link cut tree
高斯消元
cdq分治——bzoj2683简单题
半平面交
关于向量,凸包及旋转卡壳
状压dp:luogu P2704 [NOI2001]炮兵阵地
-
原文地址:https://www.cnblogs.com/iwaitu/p/1712298.html
Copyright © 2020-2023
润新知