G
Guest
Can you access the same url from a browser at work?
Brad Roberts said:Can you access the same url from a browser at work?
Binh said:Hi,
I write a C# to get information from a XML site, when I run my program at
home, there's no problem.
But when in office (no proxy, no firewall, port 80 is open), I've got
this
error:
---------------
Unhandled Exception: System.Net.WebException: The underlying connection
was
closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ReadXMLfromURL.Class1.CaptureInfo(Object state) in c:\Documents and
Settings\Binh.EEE\Local
settings\Temp\SnippetCompilerTemp\c60a33a1-29ba-4601-9d92-3bae54b7720f\0:line
32
--------------
This is the code
--------------------
using System;
using System.Xml;
using System.IO;
namespace ReadXMLfromURL
{
class Class1
{
static void Main(string[] args)
{
String URLString =
"http://www.worldpress.org/feeds/wprw.xml";
String[] Str = new String[3];
int count = 0;
XmlTextReader reader = new
XmlTextReader
(URLString);
while (reader.Read() & (count<3))
{
switch (reader.NodeType)
{
case
XmlNodeType.Element: // The node is an element.
if
(reader.Name == "title")
{
reader.Read();
Str[count] = reader.Value;
count++;
}
Console.WriteLine("<"
+ reader.Name);
break;
}
}
for (count=0;count<3;count++)
Console.WriteLine(Str[count]);
}
}
}
-------------------------------
Appreciate if you can help.
Thanks.
Brad Roberts said:Can you access the same url from a browser at work?
Binh said:Hi,
I write a C# to get information from a XML site, when I run my program at
home, there's no problem.
But when in office (no proxy, no firewall, port 80 is open), I've got
this
error:
---------------
Unhandled Exception: System.Net.WebException: The underlying connection
was
closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ReadXMLfromURL.Class1.CaptureInfo(Object state) in c:\Documents and
Settings\Binh.EEE\Local
settings\Temp\SnippetCompilerTemp\c60a33a1-29ba-4601-9d92-3bae54b7720f\0:line
32
--------------
This is the code
--------------------
using System;
using System.Xml;
using System.IO;
namespace ReadXMLfromURL
{
class Class1
{
static void Main(string[] args)
{
String URLString =
"http://www.worldpress.org/feeds/wprw.xml";
String[] Str = new String[3];
int count = 0;
XmlTextReader reader = new
XmlTextReader
(URLString);
while (reader.Read() & (count<3))
{
switch (reader.NodeType)
{
case
XmlNodeType.Element: // The node is an element.
if
(reader.Name == "title")
{
reader.Read();
Str[count] = reader.Value;
count++;
}
Console.WriteLine("<"
+ reader.Name);
break;
}
}
for (count=0;count<3;count++)
Console.WriteLine(Str[count]);
}
}
}
-------------------------------
Appreciate if you can help.
Thanks.
Brad Roberts said:Can you access the same url from a browser at work?
Binh said:Hi,
I write a C# to get information from a XML site, when I run my program at
home, there's no problem.
But when in office (no proxy, no firewall, port 80 is open), I've got
this
error:
---------------
Unhandled Exception: System.Net.WebException: The underlying connection
was
closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ReadXMLfromURL.Class1.CaptureInfo(Object state) in c:\Documents and
Settings\Binh.EEE\Local
settings\Temp\SnippetCompilerTemp\c60a33a1-29ba-4601-9d92-3bae54b7720f\0:line
32
--------------
This is the code
--------------------
using System;
using System.Xml;
using System.IO;
namespace ReadXMLfromURL
{
class Class1
{
static void Main(string[] args)
{
String URLString =
"http://www.worldpress.org/feeds/wprw.xml";
String[] Str = new String[3];
int count = 0;
XmlTextReader reader = new
XmlTextReader
(URLString);
while (reader.Read() & (count<3))
{
switch (reader.NodeType)
{
case
XmlNodeType.Element: // The node is an element.
if
(reader.Name == "title")
{
reader.Read();
Str[count] = reader.Value;
count++;
}
Console.WriteLine("<"
+ reader.Name);
break;
}
}
for (count=0;count<3;count++)
Console.WriteLine(Str[count]);
}
}
}
-------------------------------
Appreciate if you can help.
Thanks.