Exemple #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder strBuilder = new StringBuilder();

            using (StringWriter strWriter = new StringWriter(strBuilder))
            {
                string sVirURL = (null != HttpContext.Current.Items["VirtualUrl"] ? HttpContext.Current.Items["VirtualUrl"].ToString() : "");

                using (RewriteFormHtmlTextWriter htmlWriter = new RewriteFormHtmlTextWriter(strWriter, sVirURL))
                {
                    base.Render(htmlWriter);
                    string html = strBuilder.ToString();
                    html = html.Replace("\t", " ");
                    html = html.Replace("    ", " ");
                    html = html.Replace("  ", " ");
                    //html = html.Replace(Environment.NewLine, " ");
                    endTime = DateTime.Now;
                    TimeSpan ts = endTime.Subtract(startTime);
                    //string realHtml = html;
                    html = html.Replace("#LoadTime#", "-No-Cached-" + ts.TotalMilliseconds.ToString());
                    writer.Write(html);

                    if (!isUpdate && ConfigurationManager.AppSettings["AllowDistCache"] == "1")
                    {
                        SaveToCacheDependency(Request.RawUrl, html);
                    }
                }
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();

            using (StringWriter writer2 = new StringWriter(sb))
            {
                string action = (HttpContext.Current.Items["VirtualUrl"] != null) ? HttpContext.Current.Items["VirtualUrl"].ToString() : "";
                using (RewriteFormHtmlTextWriter writer3 = new RewriteFormHtmlTextWriter(writer2, action))
                {
                    base.Render(writer3);
                    string str2 = sb.ToString().Replace("\t", " ").Replace("    ", " ").Replace("  ", " ");
                    writer.Write(str2);
                }
            }
        }