Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,
I have created rss feeds from console application. I want to use them in wordpress. But wordpress does not validate my rss. For that I need to set
ContentType = "application/rss+xml"
But these is not getting possible with console application.
Please suggest some solution or round about to these.

My code is somewhat like this:
XmlTextWriter writer = new XmlTextWriter(strwriter);

// Set the formatting to something nice
writer.Formatting = Formatting.Indented;

HttpContext.Current.Response.ContentType = "application/rss+xml";
writer.WriteStartElement("rss");
writer.WriteAttributeString("version", "2.0");

writer.WriteStartElement("channel");

writer.WriteElementString("title", "Online Shopping India");
writer.WriteElementString("link", "http://www.comparethebazaar.com/");

writer.WriteElementString("description", "Comparethebazaar.Com");
writer.WriteElementString("language", "en-us");
.
.
.
Thank You.
Posted
Updated 28-Apr-11 3:39am
v2

This won't work. You have no access to a valid HttpContext in a console application.
 
Share this answer
 
If I am not wrong the content type has to be defined from wordpress, not at your xml. The httpcontext you are trying to access has no sense. You only provide an xml file, not processing a web request.

If wordpress does not recognize your feed then there may be other reasons, may be format error or their side wordpress not properly configured.

You may validate your feed through a free validator . One is here http://validator.w3.org/feed/[^]. Google helps you to find more and find out what error with your feed. If your feed has no error then you need to check wordpress configuration.
 
Share this answer
 
v2
Its not that wordpress is not recognizing my feed. But when i validate it using feed validator in wordpress, it gives certain errors. In that 1 thing it shows is to add the contenttype to "application/rss+xml". How can i solve that.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900