المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : problem with RSS feed - pubDate



C# Programming
01-01-2010, 09:40 AM
Hi All,

Hope everyone had a Merry Xmas and Happy New Year.

Just a question...I have made an RSS Feed which is syndicated by the Mozilla and IE , as an output of an XML file. However when either of the feeds show, they show the pubDate as being totally different dates to what is shown in the XML file. Even when I look at the source, the XML file still shows the correct dates as opposed to what is shown in the browser.
What do you guys think is the problem? Heres my code. Cheers.


public static void CreateNewsFeed(string mappath)
{
FileStream fs = null;
StreamWriter sw = null;

try
{


using (SqlConnection conn = Connection.connect())
{


SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "ShowNewsFeed";
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader reader = cmd.ExecuteReader();

fs = new FileStream(mappath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
sw = new StreamWriter(fs);

sw.WriteLine("");
//ISO-8859-1
//xmlns:atom=\"http://www.w3.org/2005/Atom\"

sw.WriteLine("");
sw.WriteLine("");
sw.WriteLine("Company Name");
sw.WriteLine("http://www.companyname.com.au/Home/News/News.aspx");
sw.WriteLine("News and the latest updates");
sw.WriteLine("en-us");


while (reader.Read())
{
DateTime dt = (DateTime)reader["datePosted"];

sw.WriteLine("");
sw.WriteLine("" + reader["title"].ToString() + "");
sw.WriteLine("http://www.companyname.com.au/NewsArticle.aspx?newsID=" + reader["newsID"] + "");
sw.WriteLine("" + reader["description"].ToString() + "");
sw.WriteLine("" + dt.ToString("R") + "");
sw.WriteLine("");

}

sw.WriteLine("");
sw.WriteLine("");
sw.Close();
fs.Close();

}
}
catch (Exception m)
{

throw new Exception(m.Message);
}

}