asp.net:aspx页面转换成xml

来源:百度知道 编辑:UC知道 时间:2024/04/29 13:10:40
我在做一个网站的rss,运行出来的.aspx页面是xml格式的,我想把这个.aspx页面直接转换成.xml文件,请问该怎么做?如果能实现我一定把分补上!

write some automation code to access your page and save the response
or override Render method to save the output, for example (make sure to give ASPNET account write permissions in the current directory)

protected override void Render(HtmlTextWriter output)
{
StringWriter sw;
HtmlTextWriter htmltw;
sw = new StringWriter();
htmltw = new HtmlTextWriter(sw);
base.Render(htmltw);

String sTemp = sw.ToString();

StreamWriter writer = File.CreateText(Server.MapPath("somehtml.html"));
writer.Write(sTemp);
writer.Close();

//write it out to the browser
output.Write(sTemp);
}