Display (Show) wordpress blog in ASP.Net website

srawat
 
on Oct 29, 2021 02:47 AM
432 Views

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();

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download