I want to show wordpress blog into my asp.net website.
private void GetRSS()
{
//Create a WebRequest
WebRequest rssReq = WebRequest.Create("http://www.asp.net/news/rss.ashx");
//Create a Proxy
WebProxy px = new WebProxy("http://www.asp.net/news/rss.ashx", true);
//Assign the proxy to the WebRequest
rssReq.Proxy = px;
//Set the timeout in Seconds for the WebRequest
rssReq.Timeout = 5000;
try
{
//Get the WebResponse
WebResponse rep = rssReq.GetResponse();
//Read the Response in a XMLTextReader
XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());
//Create a new DataSet
DataSet ds = new DataSet();
//Read the Response into the DataSet
ds.ReadXml(xtr);
//Bind the Results to the Repeater
rssRepeater.DataSource = ds.Tables[2];
rssRepeater.DataBind();
}
catch(Exception ex)
{
throw ex;
}
}
I am using this code from your website and return error like (The remote server returned an error: (400) Bad Request.) on this line
WebResponse rep = rssReq.GetResponse();