다음은 localhost 개발 사이트의 라이브 북마크로 사용하는 간단한 ASP.NET 2 기반 RSS 피드입니다.
<%@ Page Language="C#" EnableViewState="false" %>
<%@ OutputCache Duration="300" VaryByParam="none" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.DirectoryServices" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.Specialized.StringCollection HideSites = new StringCollection();
System.Collections.Generic.List<string> Sites = new System.Collections.Generic.List<string>();
HideSites.Add(@"IISHelp");
HideSites.Add(@"MSMQ");
HideSites.Add(@"Printers");
DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/W3SVC/1/ROOT");
foreach (DirectoryEntry site in entry.Children)
{
if (site.SchemaClassName == "IIsWebVirtualDir" && !HideSites.Contains(site.Name))
{
Sites.Add(site.Name);
}
}
Sites.Sort();
Response.Clear();
Response.ContentType = "text/xml";
XmlTextWriter RSS = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
RSS.WriteStartDocument();
RSS.WriteStartElement("rss");
RSS.WriteAttributeString("version","2.0");
RSS.WriteStartElement("channel");
RSS.WriteElementString("title", "Localhost Websites");
RSS.WriteElementString("link","http://localhost/sitelist.aspx");
RSS.WriteElementString("description","localhost websites");
foreach (string s in Sites)
{
RSS.WriteStartElement("item");
RSS.WriteElementString("title", s);
RSS.WriteElementString("link", "http://localhost/" + s);
RSS.WriteEndElement();
}
RSS.WriteEndElement();
RSS.WriteEndElement();
RSS.WriteEndDocument();
RSS.Flush();
RSS.Close();
Response.End();
}
</script>
CodeIgniter에 RSS가 지원되지 않습니까? – DisgruntledGoat