刚写的,Rss2.0输出,用XmlTextWriter完成,贴给你
V_UserGirlPhotos[] photos = gatway.From<V_UserGirlPhotos>()
.OrderBy(V_UserGirlPhotos._.DateCreated.Desc).ToArray<V_UserGirlPhotos>(100);
XmlTextWriter writer = new XmlTextWriter(MapPath("~/rss.xml"), System.Text.Encoding.UTF8);
writer.Indentation = 3;
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument(true);
writer.WriteStartElement("rss");
writer.WriteAttributeString("version","2.0");
writer.WriteStartElement("channel");
writer.WriteStartElement("title");
writer.WriteString("Girls2You.Com RSS");
writer.WriteEndElement();
writer.WriteStartElement("link");
writer.WriteString("http://ww.girls2you.com");
writer.WriteEndElement();
writer.WriteStartElement("description");
writer.WriteString("desc");
writer.WriteEndElement();
foreach (V_UserGirlPhotos p in photos)
{
writer.WriteStartElement("item");
writer.WriteStartElement("title");
writer.WriteCData(p.Title);
writer.WriteEndElement();
writer.WriteStartElement("link");
writer.WriteCData("http://www.girls2you.com/detail.aspx?ID=" + p.ID);
writer.WriteEndElement();
writer.WriteStartElement("description");
string src = "<img src='" + SiteConst.WEBSITE + ResolveUrl(p.LargeImageUrl) + "' border='0' />";
writer.WriteCData(src + "<div>Tags:" + p.RssLinkTags + "</div>");
writer.WriteEndElement();
writer.WriteElementString("pubDate", p.DateCreated.ToString());
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
Response.Redirect("rss.xml",true);