473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Need help for dotNet



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
4 1113
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: Mark Kamoski | last post by:
Hi-- Please help. I need a code sample for bubble sort. Thank you. --Mark
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
1
by: Juan Dent | last post by:
Hi, The Request.SaveAs method stores in a file the complete HTTP request including the HttpVersion. However when I try to reproduce in memory the same thing, I cannot find the "HTTP/1.1"...
8
by: Elliot M. Rodriguez | last post by:
I am having a heckuva time debugging this, or determining why my page is behaving this way. I have a search form, that when completed, returns a datagrid. When the user selects a row (normal...
11
by: Larry | last post by:
I will be teaching an eCommerce application development course using ASP.Net after many years of having taught classic ASP. (Course was interrupted by 18 months in the Middle East with my Army...
4
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I...
1
by: skootr | last post by:
Has anyone seen any COMPLETE bound form examples? By complete, I mean a form that has Add/Edit/Delete capabilities. Every example I've seen on the 'net, in books, and in the VB.Net Resource Kit...
22
by: OHM \( Terry Burns \) | last post by:
I was thinking about community the other day, and wondering what would be the holy grail for a developer in need. I mean, we do get help here, but its done on a best endeavours basis and its really...
3
by: Saeid | last post by:
Hi, I want to buy a book about .net Webservices, does any body have a suggestion? Thanks ------------------------ The soldier of Persian Empire
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...

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.