1?óúRss
RSSê?12?í?úèYμ?ò????òò×·?ê?,ò23???o?.í¨3£±?ó?óúD???oíBlog?£í???ìá1?RSSê?3?£?óDà?óúè?ó??§·¢??í????úèYμ??üD??£í???ó??§?éò??è?úóú?§3?RSSμ?D?????o?1¤??èí?t?ò???ú??í???£¨è?BLOGLINES£?£?????í???μ??úèY2¢?ú2?′ò?aí???ò3??μ??é???????á?úèY?£
RSSê??ùóúXMLμ?ò???D?ê?£???ì?1?·??ò?í2??μá?£?????ê?è?o?ê1ó?ASP.NETêμ??
í¨?a?ˉàà?÷í???ìá1?á?RSSê?3?£o
°?????μ??a??·??ú2??í?ò?a??μ?μ?<head>±ê???D
<link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/lbk/rss.aspx" />
′′?¨RSS.ASPX???t
??á??????aò?DD£???óàμ???é?μ??£
<%@ Page language="c#" Codebehind="Rss.aspx.cs" AutoEventWireup="false" Inherits="Test.Rss" %>
oóì¨′ú??£?Rss.aspx.cs
?aà?XML???t?úèYμ?ê?3?ê?2éó??±?óê?3?×?·?′?μ?D?ê?£??ú?ò?′à′?°??±è???òμ¥£???ò2?éò?ê1ó?XmlTextWriterà′êμ???£
private void Page_Load(object sender, System.EventArgs e)
?? {
???? Response.ContentType="text/xml";
???? Response.Charset = "UTF-8";
???? Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
???? Response.Write("<rss version=\"2.0\"><channel>");
???? Response.Write(GetUserRSS());
???? GetItemsRss();
???? Response.Write("</channel></rss>");
}
//′?RSSμ?ò?D?D??¢
private string GetUserRSS(NewTaokee.Model.Users user)
???? {
???????? StringBuilder strRss = new StringBuilder();
???????? strRss.Append("<title>lbk</title>");
???????? strRss.Append("<link>lbk.cnblogs.com</link> ");
???????? strRss.Append("<description>o?o?£??íê??ò</description> ");
???????? strRss.Append("<language>zh-cn</language>");
???????? strRss.Append("<generator>www.xiaoqian.cn </generator>");
???????? return strRss.ToString();
???? } //?-?·?áè?RSS?Dμ?????ITEMμ??úèY
private string getRss(IList<Model.Info> listInfo)
???? {
???????? StringBuilder strRss = new StringBuilder();
???????? foreach (Model.Info var in listInfo)
???????? {
???????????? string nickname = DAL.Users.instance.GetModelBasic(var.Author).NickName;
???????????? string content = Function.ReplaceHtml(var.Content);
???????????? content = Function.ReplaceXml(content);
???????????? content = (content.Length > 300) ? content.Substring(0, 300) + "" : content;
???????????? string link = Function.getConfig("MyUrl") + nickname + "/blog/item/" + var.id;
???????????? strRss.Append("<item>");
???????????? strRss.Append("<title>" + Function.ReplaceXml(var.Title) + "</title>");
???????????? strRss.Append("<author>" + nickname + "</author>&
|