|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.IO;
using System.Net;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string xmlsrc = "http://rss.news.yahoo.com/rss/topstories";
string Password = "xxxxx";
string UserAccount = "xxxxx";
string DomainName = "xxxxx";
string ProxyServer = "192.168.1.1:8080";
string xslsrc = "RSS91.xsl";
if (xmlsrc != "")
{
// make remote request
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(xmlsrc);
if (UserAccount != "")
{
wr.Credentials = new NetworkCredential(UserAccount, Password, DomainName);
}
// set proxy server
if (ProxyServer != "")
{
wr.Proxy = new WebProxy(ProxyServer, true, new string[] { }, wr.Credentials);
}
// set the HTTP properties
wr.Timeout = 10000;
// 10 seconds
// read the response
WebResponse resp = wr.GetResponse();
Stream stream = resp.GetResponseStream();
// load XML document
XmlTextReader reader = new XmlTextReader(stream);
reader.XmlResolver = null;
XmlDocument doc = new XmlDocument();
doc.Load(reader);
xmlRSS.Document = doc;
}
xmlRSS.TransformSource = xslsrc;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.