473,473 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RSS Feeds

Hello,

I am trying to learn how to consume RSS feeds and downloaded the example
from the MSDN site:

http://msdn.microsoft.com/coding4fun...spx?print=true
However, I am getting the following error at:
rssData.ReadXml(rssFeed.GetResponse().GetResponseS tream()); even though I
can go directly to the site.

Any help with this would be appreciated.

Thanks, sck10

private DataSet RefreshFeed()
{
HttpWebRequest rssFeed =
(HttpWebRequest)WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml");

DataSet rssData = new DataSet();
rssData.ReadXml(rssFeed.GetResponse().GetResponseS tream());

return rssData;
}
Error Statement
+++++++++++++++++++++
System.Net.WebException was unhandled by user code
Message="Unable to connect to the remote server"
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at RssList.RefreshFeed() in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.as cx.cs:line 30
at RssList.Page_Load(Object sender, EventArgs e) in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.as cx.cs:line 12
at System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp,
Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object
sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.BasePartialCachingControl.LoadRecurs ive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Oct 3 '06 #1
9 2716
you have to create a data source as well

>

Oct 3 '06 #2
Hello sck10,

A simplified way to consume an RSS feed. Place a data repeater rptrRssFeed
on your web form:

XmlReader rssReader = new XmlTextReader(rssUrl);
DataSet ds = new DataSet();
ds.ReadXml(rssReader);

rptrRssFeed.DataSource = ds.Tables["item"];
rptrRssFeed.DataBind();

Add support for caching and exception handling to make it more robust.
--
brians
http://www.limbertech.com
"sck10" wrote:
Hello,

I am trying to learn how to consume RSS feeds and downloaded the example
from the MSDN site:

http://msdn.microsoft.com/coding4fun...spx?print=true
However, I am getting the following error at:
rssData.ReadXml(rssFeed.GetResponse().GetResponseS tream()); even though I
can go directly to the site.

Any help with this would be appreciated.

Thanks, sck10

private DataSet RefreshFeed()
{
HttpWebRequest rssFeed =
(HttpWebRequest)WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml");

DataSet rssData = new DataSet();
rssData.ReadXml(rssFeed.GetResponse().GetResponseS tream());

return rssData;
}
Error Statement
+++++++++++++++++++++
System.Net.WebException was unhandled by user code
Message="Unable to connect to the remote server"
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at RssList.RefreshFeed() in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.as cx.cs:line 30
at RssList.Page_Load(Object sender, EventArgs e) in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.as cx.cs:line 12
at System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp,
Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object
sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.BasePartialCachingControl.LoadRecurs ive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Oct 3 '06 #3
Thanks brians
"brians[MCSD]" <br********@discussions.microsoft.comwrote in message
news:E2**********************************@microsof t.com...
Hello sck10,

A simplified way to consume an RSS feed. Place a data repeater rptrRssFeed
on your web form:

XmlReader rssReader = new XmlTextReader(rssUrl);
DataSet ds = new DataSet();
ds.ReadXml(rssReader);

rptrRssFeed.DataSource = ds.Tables["item"];
rptrRssFeed.DataBind();

Add support for caching and exception handling to make it more robust.
--
brians
http://www.limbertech.com
"sck10" wrote:
>Hello,

I am trying to learn how to consume RSS feeds and downloaded the example
from the MSDN site:

http://msdn.microsoft.com/coding4fun...spx?print=true
However, I am getting the following error at:
rssData.ReadXml(rssFeed.GetResponse().GetResponse Stream()); even though I
can go directly to the site.

Any help with this would be appreciated.

Thanks, sck10

private DataSet RefreshFeed()
{
HttpWebRequest rssFeed =
(HttpWebRequest)WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml");

DataSet rssData = new DataSet();
rssData.ReadXml(rssFeed.GetResponse().GetResponseS tream());

return rssData;
}
Error Statement
+++++++++++++++++++++
System.Net.WebException was unhandled by user code
Message="Unable to connect to the remote server"
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at RssList.RefreshFeed() in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.a scx.cs:line 30
at RssList.Page_Load(Object sender, EventArgs e) in
c:\Inetpub\wwwroot\gsttcsharp\ztest\rss\RssList.a scx.cs:line 12
at System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp,
Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object
sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.BasePartialCachingControl.LoadRecurs ive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Oct 3 '06 #4
Hello Steve,

Have you got the code working?

From the original error info and callstack you provided, the problem is
likely due to the web access through the HttpWebRequest class( exception
raises at WebRequest.GetResponse ...).

When using httpwebrequest, one thing we'd take care is whether the
webrequest component can get a correct web proxy (if it is required in the
certain network environment). You can try using the system's default proxy
(from IE setting...) or explicitly specify a proxy. e.g.

==================
protected void Page_Load(object sender, EventArgs e)
{
HttpWebRequest request =
WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml") as
HttpWebRequest;

request.Method = "GET";
request.Proxy = WebProxy.GetDefaultProxy();
//request.Proxy = new WebProxy("myproxy", 80);

HttpWebResponse response = request.GetResponse() as HttpWebResponse;
Stream stream = response.GetResponseStream();

DataSet ds = new DataSet();
ds.ReadXml(stream);

stream.Close();
response.Close();
GridView1.DataSource = ds.Tables["item"];
GridView1.DataBind();
}
==================

Hope this helps also.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 4 '06 #5
Hi Steven,

I tried your code, but I got the error:
System.Net.WebProxy.GetDefaultProxy()' is obsolete.

Also, I have created a page that uses the XmlDataSource control

<asp:XmlDataSource runat="server"
ID="XmlDataSource"
DataFile="~/ztest/rss/msdnvb.xml"
XPath="rss/channel/item" />

and I created a page that calls the XmlTextReader:
try
{
string rssUrl = "http://msdn.microsoft.com/vbasic/rss.xml";
//rssUrl = "http://myxml.com/ztest/rss/msdnvb.xml";
XmlReader rssReader = new XmlTextReader(rssUrl);
DataSet ds = new DataSet();
ds.ReadXml(rssReader);

rptRSS.DataSource = ds.Tables["item"];
rptRSS.DataBind();
}

catch(Exception ex)
{
this.lblMessageText.Text = "RSS Feed Error: " +
ex.Message.ToString();
}

When I run the last two pages, I get the error: "Unable to connect to the
remote server". So I copied the xml file
(http://msdn.microsoft.com/vbasic/rss.xml) and the xsl file from the
Microsoft site to my site. When I did that, I could read the file in both
pages. However, I am unable to pull the file from other sites. Do you
think this relates to the original problem that you addressed?

By the way, which method would you prefer? the XmlDataSource control or
using XmlTextReader?

Thanks again, sck10



"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:r2**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

Have you got the code working?

From the original error info and callstack you provided, the problem is
likely due to the web access through the HttpWebRequest class( exception
raises at WebRequest.GetResponse ...).

When using httpwebrequest, one thing we'd take care is whether the
webrequest component can get a correct web proxy (if it is required in the
certain network environment). You can try using the system's default
proxy
(from IE setting...) or explicitly specify a proxy. e.g.

==================
protected void Page_Load(object sender, EventArgs e)
{
HttpWebRequest request =
WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml") as
HttpWebRequest;

request.Method = "GET";
request.Proxy = WebProxy.GetDefaultProxy();
//request.Proxy = new WebProxy("myproxy", 80);

HttpWebResponse response = request.GetResponse() as
HttpWebResponse;
Stream stream = response.GetResponseStream();

DataSet ds = new DataSet();
ds.ReadXml(stream);

stream.Close();
response.Close();
GridView1.DataSource = ds.Tables["item"];
GridView1.DataBind();
}
==================

Hope this helps also.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 4 '06 #6
Hi Steven,

The issue has been resolved.
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:r2**************@TK2MSFTNGXA01.phx.gbl...
Hello Steve,

Have you got the code working?

From the original error info and callstack you provided, the problem is
likely due to the web access through the HttpWebRequest class( exception
raises at WebRequest.GetResponse ...).

When using httpwebrequest, one thing we'd take care is whether the
webrequest component can get a correct web proxy (if it is required in the
certain network environment). You can try using the system's default
proxy
(from IE setting...) or explicitly specify a proxy. e.g.

==================
protected void Page_Load(object sender, EventArgs e)
{
HttpWebRequest request =
WebRequest.Create("http://msdn.microsoft.com/vbasic/rss.xml") as
HttpWebRequest;

request.Method = "GET";
request.Proxy = WebProxy.GetDefaultProxy();
//request.Proxy = new WebProxy("myproxy", 80);

HttpWebResponse response = request.GetResponse() as
HttpWebResponse;
Stream stream = response.GetResponseStream();

DataSet ds = new DataSet();
ds.ReadXml(stream);

stream.Close();
response.Close();
GridView1.DataSource = ds.Tables["item"];
GridView1.DataBind();
}
==================

Hope this helps also.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 5 '06 #7
Thanks for your followup Steve,

Glad that you've got the issue resolved.

BTW, it would also be great that if you can share your final solution with
us, that will be helpful to other members also.

Have a good day!
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 9 '06 #8
Hi Walter,

This is what I am using, but you also suggested that I use a custom tool:

try
{
WebRequest req =
WebRequest.Create(http://rss.cnn.com/rss/cnn_topstories.rss);

// Get Website Proxy
req.Proxy = new WebProxy("global.proxy.lucent.com:8000", true);
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();

// Stream the data
StreamReader textReader = new StreamReader(resp.GetResponseStream());
XmlTextReader xmlReader = new XmlTextReader(textReader);
//XmlReader rssReader = new XmlTextReader(rssUrl);

// Build Dataset
DataSet dsRSS = new DataSet();
dsRSS.ReadXml(xmlReader);

// Populate Repeater Tool
rptRSS.DataSource = dsRSS.Tables["item"];
rptRSS.DataBind();
}

catch(Exception ex)
{
this.pnlMessage.Visible = true;
this.lblMessageTitle.Text = "RSS Feed Error";
this.lblMessageText.Text =
"<span class=BlkB>Record Not Found</span><br />" +
"Problems consuming RSS Feed for" +
"<br /><br /><span class=BlkB>RSS Feed Error</span><br />" +
ex.Message.ToString();
}

Regards, sck10
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:u1**************@TK2MSFTNGXA01.phx.gbl...
Thanks for your followup Steve,

Glad that you've got the issue resolved.

BTW, it would also be great that if you can share your final solution with
us, that will be helpful to other members also.

Have a good day!
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 10 '06 #9
Hi Steve,

Thanks for the followup and sharing the code with us.

BTW, I think you've mistaken me with Walter as Walter has also worked with
you in anthoer thread :)

Have a good day!
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 11 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: the_ainbinders | last post by:
Anything like this around anywhere? Need to be able to input RSS information for several feeds and have it create an OMPL file. TIA, Rob
6
by: plazma_41 | last post by:
Are there any uses for rss feeds on commercial websites selling products/services? Yes! I've just realized that eMaximarket Auctions ( http://www.emaximarket.com ) provides RSS feeds. For...
5
by: Mike Mella | last post by:
If I make an RSS feed of my site, am I expected to build and later update the RSS (XML) data by hand as I would any other webpage, or is there some process by which updates to a site are...
1
by: richards1052 | last post by:
I am setting up a forum website at which I plan to set up a news aggregator to pick up news headlines about the Mideast. But I've only been able to find a few news resources that have specific...
3
by: Mike | last post by:
I want to create a ticker type app that consume RSS feeds from several sites, where can i find some informaton or code snippets now how to consume the RSS feeds and display the data?
2
by: Patrick Olurotimi Ige | last post by:
I wanto to incorporate some feeds like weather,news and humor(funny stuff) Any links where i can get related feeds on the WEB? Thx *** Sent via Developersdex http://www.developersdex.com ***
0
by: jmwatte | last post by:
OK... 2 RSS feeds ... "http://feeds.feedburner.com/brainyquote/QUOTENA" "http://feeds.feedburner.com/qotd" Now I build a RSS reader in C#Express(did several of them including the starterkit)...
2
by: dkode | last post by:
I built an asp.net usercontrol that consumes rss feeds that I specify the url for. Some of them (MVP blogs, google news) consumes the feeds just fine. and other times (75%) it chokes on...
5
by: Shawn | last post by:
Hi, I want to understand and follow RSS feed because many web pages provide RSS feed for updated new data(e.g. http://www.weather.gov/rss/). But I never get how to use it. The link below suppose...
1
by: Rama Jayapal | last post by:
hi i am developing a web application where i have to read multiple XML feeds amd store their values to database but i require the same type of fields from multiple XML feeds like for...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.