lhlapx8yiw
New Member
Tryed to search in google, but have not found anything useful to solve this problem, so here we are.Have a page, where using RSS should alert 10 last news from DB. Have done this task using this lesson - http://net.tutsplus.com/tutorials/asp-net/how-to-build-an-rss-feed-with-asp-net/ Seems like I did everything right, but when i start my application - I have a next error, or alert, nvm:\[code\]This XML file does not appear to have any style information associated with it. The document tree is shown below.<rss version="2.0"><channel><title>Name of the website</title><link>http://pudel.com</link><description>Short description of the site</description><item><title>Jenzyk Polski</title><link>http://localhost:56957/rss.aspx?ID=11</link><pubDate>Wed, 03 Apr 2013 00:00:00 GMT</pubDate><description>Co to jest?</description></item><item><title>Czy mowic pana zona po Polsku?</title><link>http://localhost:56957/rss.aspx?ID=13</link><pubDate>Tue, 02 Apr 2013 00:00:00 GMT</pubDate><description>Tak, bardzo dobze mowic</description></item><item><title>Kim jestes z pochodzenia?</title><link>http://localhost:56957/rss.aspx?ID=12</link><pubDate>Tue, 02 Apr 2013 00:00:00 GMT</pubDate><description>Jestes Polakiem</description></item></channel></rss>[/XML]\[/code\]Surely, this view is not what I have planed to do. So, where is the problem? Tryed to open with different browsers-all the same. Tryed to change encoding in web.config from UTF-8 to WINDOWS-1251 - all the same.Here is the code for rss.aspx.cs page:\[code\] using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; namespace softacom.pb{public partial class rss : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { string connString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection sqlConn = new SqlConnection(); sqlConn.ConnectionString = connString; string sqlQuery = "SELECT TOP 10 newsID, Title, Date, Description FROM News ORDER BY Date DESC"; SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlConn; cmd.CommandType = CommandType.Text; cmd.CommandText = sqlQuery; sqlConn.Open(); RepeaterRSS.DataSource = cmd.ExecuteReader(); RepeaterRSS.DataBind(); sqlConn.Close(); } protected string RemoveIllegalCharacters(object input) { string data = http://stackoverflow.com/questions/15761945/input.ToString(); data = http://stackoverflow.com/questions/15761945/data.Replace("&", "&"); data = http://stackoverflow.com/questions/15761945/data.Replace("\"", """); data = http://stackoverflow.com/questions/15761945/data.Replace("'", "'"); data = http://stackoverflow.com/questions/15761945/data.Replace("<", "<"); data = http://stackoverflow.com/questions/15761945/data.Replace(">", ">"); return data; }} }\[/code\]And here is rss.ASPX\[code\]<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeBehind="rss.aspx.cs" Inherits="softacom.pb.rss" %> <asp:Repeater ID="RepeaterRSS" runat="server"> <HeaderTemplate> <rss version="2.0"> <channel> <title>Name of the website</title> <link>http://pudel.com</link> <description> Short description of the site</description> </HeaderTemplate> <ItemTemplate> <item> <title><%# RemoveIllegalCharacters(DataBinder.Eval(Container.DataItem, "Title"))%> </title> <link>http://localhost:56957/rss.aspx?ID=<%# DataBinder.Eval(Container.DataItem, "newsID") %></link> <pubDate><%# String.Format("{0:R}", DataBinder.Eval(Container.DataItem, "Date"))%> </pubDate> <description><%# RemoveIllegalCharacters(DataBinder.Eval(Container.DataItem, "Description"))%></description> </item> </ItemTemplate> <FooterTemplate> </channel> </rss> </FooterTemplate> </asp:Repeater> \[/code\]