By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

Need help for dotNet

P: n/a


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(IAsyncRes ult 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.
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Can you access the same url from a browser at work?

"Binh" wrote:


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(IAsyncRes ult 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.

Nov 18 '05 #2

P: n/a
The Service and the app are on my machine.
Even in the browser when I debug the Web Service I can't get it working
"Brad Roberts" <Br*********@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Can you access the same url from a browser at work?

"Binh" wrote:


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(IAsyncRes ult 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.

Nov 18 '05 #3

P: n/a
Opps I thought I was clicked on my post,
Sorry!

"Brad Roberts" <Br*********@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Can you access the same url from a browser at work?

"Binh" wrote:


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(IAsyncRes ult 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.

Nov 18 '05 #4

P: n/a
Yes, I can

"Brad Roberts" <Br*********@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Can you access the same url from a browser at work?

"Binh" wrote:


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(IAsyncRes ult 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.

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.