Hi
try this example to create Rss Feed using linq :-
1) create new website using VS 2008
2) In this example i use Northwind database
3) Add new Data Context Class called “Northwind.dbml” and add Employee table in it
4) Add new web page and in code behind add the following code
protected void Page_Load(object sender, EventArgs e)
{
NorthwindDataContext context = new NorthwindDataContext();
Response.Clear();
Response.ContentType = "text/xml";
XDocument document = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement("rss",
new XElement("channel",
new XElement("title", "Employees of Northwind Traders Inc."),
new XElement("link", "http://www.yoursite.com"),
new XElement("description", "Employees of Northwind Traders Inc. ordered by last name."),
from emp in context.Employees
orderby emp.LastName
select new XElement("item",
new XElement("title", emp.LastName + ", " + emp.FirstName),
new XElement("description", emp.Notes),
new XElement("link", "http://www.yoursite.com/Details.aspx?id=" + emp.EmployeeID))
),
new XAttribute("version", "2.0")));
document.Save(Response.Output);
Response.End();
}
Hope this helps
Good Luck