Rss
<%@ Page language= "C #" codebehind= "RSS.aspx.cs" autoeventwireup= "false" inherits= "Socent.rss"%>
---RSS.aspx.cs
Using System;
Using System.Collections;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.SessionState;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
Namespace Socent
{
<summary>
Get aggregated articles
</summary>
public class RSS:System.Web.UI.Page
{
Components.genrss gr = new Components.genrss (); Instantiating an Object
String strrss = "";
private void Page_Load (object sender, System.EventArgs e)
{
Response.ContentType = "Application/xml"; Output and displayed as XML data
Response.Write (Getrss ());
}
<summary>
Get aggregated articles
</summary>
public string Getrss ()
{
DataSet ds = gr. Generaterss (); Call the Generaterss () method to get the data
Strrss = Strrss + "<rss version=\" 2.0\ ">";
Strrss = Strrss + "<channel>";
Strrss = Strrss + "<title> natives manufacturing </title>";
Strrss = Strrss + "<link>http://www.socent.com</link>";
Strrss = Strrss + "<description> natives manufacturing </description>";
for (int i = 0; I < ds. Tables[0]. Rows.Count; i++)
{
Strrss = Strrss + "<item>";
Strrss = Strrss + "<title><! [cdata[] +ds. Tables[0]. rows[i]["Title"]+ "]]></title>";
Strrss = Strrss + "<link>http://www.socent.com/articleshow@" +ds. Tables[0]. rows[i]["ID"]+ ".html</link>";
Strrss = Strrss + "<description><! [cdata[] +ds. Tables[0]. rows[i]["Description"]+ "]]></description>";
Strrss = Strrss + "<copyright> natives manufacturing </copyright>";
Strrss = Strrss + "<pubDate>" +convert.todatetime (ds. Tables[0]. rows[i]["Adddate"]. ToString ()). ToString ("Yyyy-mm-dd hh:mm") + "</pubDate>";
Strrss = Strrss + "<comments>http://www.socent.com/commentshow@" +ds. Tables[0]. rows[i]["ID"]+ ".html</comments>";
Strrss = Strrss + "</item>";
}
Strrss = Strrss + "</channel>";
Strrss = Strrss + "</rss>";
return strrss;
}
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
}
}