This article introduces a small example of the. NET output rewrite compressed paging file, and a friend in Need can refer to
I do not know if you have noticed, there are some Web site's HTML code is mixed together, without any space and newline and other extra characters. Its benefits are not to say--absolute optimization of the interface size. Perhaps you are thinking that they have done so much less readability. Indeed, we look very messy, and can only borrow third party software to rearrange the code. However, I think they develop the use of the source code can not be a no-name regiment, not long ago found a page base class, probably can explain this problem, not to say, look at the source:
Copy Code code as follows:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.htmlControls;
using System.Text.RegularExpressions;
using System.IO;///<summary>
///pagebase page base class
///</summary>
public class Pagebase:syste M.web.ui.page
{
protected override void Render (HtmlTextWriter writer)
{
stringwriter sw = new StringWriter ();
& nbsp; HtmlTextWriter htmlwriter = new HtmlTextWriter (SW);
Base. Render (HTMLWriter);
String html = sw. ToString ();
HTML = regex.replace (HTML, "[F v]", "");
&NBSP;&NBSP;&NBsp; HTML = regex.replace (HTML, "{2,}", "");
HTML = regex.replace (HTML, ">[]{1}", ">");
Writer. Write (HTML);
}
}