Need help for the .net

  • Thread starter Thread starter phangmo
  • Start date Start date
P

phangmo

Hi,
When I run my program at home, there's no problem.
But when I run it in office, 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 System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri,
ICredentials credentials)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)

at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn)
at System.Xml.XmlTextReader.CreateScanner()
at System.Xml.XmlTextReader.Init()
at System.Xml.XmlTextReader.Read()
 
Hi,

Detail of the 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 System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri,
ICredentials credentials)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials)

at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role,
Type ofObjectToReturn)
at System.Xml.XmlTextReader.CreateScanner()
at System.Xml.XmlTextReader.Init()
at System.Xml.XmlTextReader.Read()
at ReadXMLfromURL.Class1.Main(String[] args) in c:\Documents and
Settings\EEE\Local
Settings\Temp\SnippetCompilerTemp\480e93cf-471d-41aa-9b73-9c655f9569b2\0:line
23
---------------

This is part of 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 URLString =
"http://websep.settrade.com/broadcast/mgr/StockNews.jsp";
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 == "DETAIL")
{
reader.Read();
Str[count] = reader.Value;
count++;
.... }
 

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

Back
Top