日期:2014-05-19  浏览次数:20407 次

如何将aspx的输出页面的html代码 保存到string中
如何将aspx的输出页面的html代码   保存到string中

------解决方案--------------------
protected override void Render( HtmlTextWriter writer )
{
System.IO.StringWriter html = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(html);
base.Render(tw);

/// html.ToString();

}

------解决方案--------------------
PageUrl = "http://www.sdnews.com.cn/news/2007/5/11/53388.html ";
WebRequest request = WebRequest.Create(PageUrl);
WebResponse response = request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default);
reText = sr.ReadToEnd();
resStream.Close();
sr.Close();


reText 里面存储的值即为HTML代码~~~
------解决方案--------------------
StringBuilder sb=new StringBuilder ();
sb.Append( "aaa ");
sb.Append( "aaa ");
sb.Append( "aaa ");
sb.toString();
是不是说这个?