myProxy.Credentials

S

Simon Harris

Hi,

I am trying to build a function to output an RSS feed to a dataset. Code
below shows how far I have got.

I am having problems getting past our proxy (ISA). Sorry, cant remember
the
exact error now, but I'm pretty sure I need to be requesting the data as
an
authenticated user.

As you can see, I've tried using WebProxy for this - I'm just not sure how
to tell the XmlTextReader to use the proxy object.

Any help will be appreciated.

Many Thanks,
Simon.


Function GetRSSFeed(ByVal RSSURL As String) As DataSet

'Setup Proxy
Dim myProxy As New
System.Net.WebProxy("http://MYPROXYADDRESS:8080",
True)
myProxy.Credentials = New
System.Net.NetworkCredential("MYUSERNAME",
"MYPASSWORD", "MYDOMAIN")

'Set up XML reader
Dim reader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(RSSURL)

Dim ds As DataSet = New DataSet

'Get and return data
ds.ReadXml(reader)
Return ds
End Function
 
M

Matt Berther

Hello Simon,

I think you're going to have to use WebClient class to get the stream and
then feed that to your XmlReader.

[C#]
WebClient client = new WebClient();
client.Proxy = New System.Net.WebProxy("http://MYPROXYADDRESS:8080", true);

Stream strm = client.OpenRead(rssUrl);
XmlTextReader reader = new XmlTextReader(strm);

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

This is untested, but should lead you in the right direction. Hope this helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top