Hello,

I'm developing a C# - windows forms application. To get some information
for my application, I'm connecting to an URL, wich gives me XML
generated using php.
With 90% of the users, this code just works fine:

[code]

WebRequest request = WebRequest.Create(URL);

try
{
request.Timeout = 50000;
WebResponse response = request.GetResponse();
}
catch(Exception ex)
{
WriteToLog(LogType.Info,ex.Message.ToString());
response = null;
}

[/code]

But with some users, I get an exception saying: The underlying
connection was closed: Unable to connect to the remote server

I'm sure that there is no firewall on, and I've asked the user to
disable any proxy settings...

Is there something that I'm overseeing or that can be improved to this code?


thanks in advance,

Kristof

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Mon Mar 14 09:53:45 CST 2005

This can happen when the request lacks something like for example a cookie.
Are there other ways in which you can connect? If so, have a look with
ethereal what goes over the wire. That sometimes gives the required
information.

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d148vq$ksn$1@ikaria.belnet.be...
> Hello,
>
> I'm developing a C# - windows forms application. To get some information
> for my application, I'm connecting to an URL, wich gives me XML generated
> using php.
> With 90% of the users, this code just works fine:
>
> [code]
>
> WebRequest request = WebRequest.Create(URL);
>
> try
> {
> request.Timeout = 50000;
> WebResponse response = request.GetResponse();
> }
> catch(Exception ex)
> {
> WriteToLog(LogType.Info,ex.Message.ToString());
> response = null; }
>
> [/code]
>
> But with some users, I get an exception saying: The underlying connection
> was closed: Unable to connect to the remote server
>
> I'm sure that there is no firewall on, and I've asked the user to disable
> any proxy settings...
>
> Is there something that I'm overseeing or that can be improved to this
> code?
>
>
> thanks in advance,
>
> Kristof



Re: Problem: The underlying connection was closed: Unable to connect to the remote server by Landi

Landi
Mon Mar 14 10:28:31 CST 2005

Kristof,
Your code is fine. It's the URL that you are connecting to that is making
your code throw an exception. I am assuming this is your server that is
giving you the XML; if so then I would make sure that the server is working
properly and that it's never loosing connection.

--
info@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials
"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d148vq$ksn$1@ikaria.belnet.be...
> Hello,
>
> I'm developing a C# - windows forms application. To get some information
> for my application, I'm connecting to an URL, wich gives me XML
> generated using php.
> With 90% of the users, this code just works fine:
>
> [code]
>
> WebRequest request = WebRequest.Create(URL);
>
> try
> {
> request.Timeout = 50000;
> WebResponse response = request.GetResponse();
> }
> catch(Exception ex)
> {
> WriteToLog(LogType.Info,ex.Message.ToString());
> response = null;
> }
>
> [/code]
>
> But with some users, I get an exception saying: The underlying
> connection was closed: Unable to connect to the remote server
>
> I'm sure that there is no firewall on, and I've asked the user to
> disable any proxy settings...
>
> Is there something that I'm overseeing or that can be improved to this
code?
>
>
> thanks in advance,
>
> Kristof



Re: Problem: The underlying connection was closed: Unable to connect to the remote server by Mezzrow

Mezzrow
Mon Mar 14 16:05:56 CST 2005

Yep.
When writing these types of apps its important to not presume that the
URL will be available. Its good practice to also double check the
formatting of the XML, but that's not what's happening here.


Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 03:04:01 CST 2005

Mezzrow wrote:
> Yep.
> When writing these types of apps its important to not presume that the
> URL will be available. Its good practice to also double check the
> formatting of the XML, but that's not what's happening here.
>

The strange thing is, that with 19 of the 20 testusers, it is working
just fine. But with one user, it keeps on giving this error...
I believe it must be some kind of setting but I kind find out wich one...
It isn't the firewall, he doesn't have a proxyserver set, and the server
works fine, because at the same moment I'm able to connect...

So I'm really stuck...

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 03:25:48 CST 2005

What difference does ethereal show between a successfull and a failed
attempt?

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d168e0$tho$1@ikaria.belnet.be...
> Mezzrow wrote:
>> Yep.
>> When writing these types of apps its important to not presume that the
>> URL will be available. Its good practice to also double check the
>> formatting of the XML, but that's not what's happening here.
>>
>
> The strange thing is, that with 19 of the 20 testusers, it is working just
> fine. But with one user, it keeps on giving this error...
> I believe it must be some kind of setting but I kind find out wich one...
> It isn't the firewall, he doesn't have a proxyserver set, and the server
> works fine, because at the same moment I'm able to connect...
>
> So I'm really stuck...



Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 03:39:27 CST 2005

I'm not that familiar with ethereal, but I tried installing it (and
wincap3.1) on my pc... But when I run my program, it doesn't seem to
catpure anything...
I don't have to run it on the server pc do I?

There is always the problem to make a program like this run on someone
elses pc, especially when he's living in Romania...

thx for you help


at wrote:
> What difference does ethereal show between a successfull and a failed
> attempt?
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d168e0$tho$1@ikaria.belnet.be...
>
>>Mezzrow wrote:
>>
>>>Yep.
>>>When writing these types of apps its important to not presume that the
>>>URL will be available. Its good practice to also double check the
>>>formatting of the XML, but that's not what's happening here.
>>>
>>
>>The strange thing is, that with 19 of the 20 testusers, it is working just
>>fine. But with one user, it keeps on giving this error...
>>I believe it must be some kind of setting but I kind find out wich one...
>>It isn't the firewall, he doesn't have a proxyserver set, and the server
>>works fine, because at the same moment I'm able to connect...
>>
>>So I'm really stuck...
>
>
>

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 04:09:44 CST 2005

Run ethereal, select Capture/Start from the menu, select an interface (you
see the drop down on top of the ethereal screen?) (I always choose my
netcard to catch anything) and click ok. That is what I do and here it
works. When I click stop it displays what it caught (if anything, you can
test by browsisng to some page somewhere). Client/server side doesn't
matter.

Any luck?

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16agn$v0q$1@ikaria.belnet.be...
> I'm not that familiar with ethereal, but I tried installing it (and
> wincap3.1) on my pc... But when I run my program, it doesn't seem to
> catpure anything...
> I don't have to run it on the server pc do I?
>
> There is always the problem to make a program like this run on someone
> elses pc, especially when he's living in Romania...
>
> thx for you help
>
>
> at wrote:
>> What difference does ethereal show between a successfull and a failed
>> attempt?
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d168e0$tho$1@ikaria.belnet.be...
>>
>>>Mezzrow wrote:
>>>
>>>>Yep.
>>>>When writing these types of apps its important to not presume that the
>>>>URL will be available. Its good practice to also double check the
>>>>formatting of the XML, but that's not what's happening here.
>>>>
>>>
>>>The strange thing is, that with 19 of the 20 testusers, it is working
>>>just fine. But with one user, it keeps on giving this error...
>>>I believe it must be some kind of setting but I kind find out wich one...
>>>It isn't the firewall, he doesn't have a proxyserver set, and the server
>>>works fine, because at the same moment I'm able to connect...
>>>
>>>So I'm really stuck...
>>
>>


Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 04:44:37 CST 2005

at wrote:
> Run ethereal, select Capture/Start from the menu, select an interface (you
> see the drop down on top of the ethereal screen?) (I always choose my
> netcard to catch anything) and click ok. That is what I do and here it
> works. When I click stop it displays what it caught (if anything, you can
> test by browsisng to some page somewhere). Client/server side doesn't
> matter.
>
> Any luck?
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d16agn$v0q$1@ikaria.belnet.be...
>
>>I'm not that familiar with ethereal, but I tried installing it (and
>>wincap3.1) on my pc... But when I run my program, it doesn't seem to
>>catpure anything...
>>I don't have to run it on the server pc do I?
>>
>>There is always the problem to make a program like this run on someone
>>elses pc, especially when he's living in Romania...
>>
>>thx for you help
>>
>>
>>at wrote:
>>
>>>What difference does ethereal show between a successfull and a failed
>>>attempt?
>>>
>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>news:d168e0$tho$1@ikaria.belnet.be...
>>>
>>>
>>>>Mezzrow wrote:
>>>>
>>>>
>>>>>Yep.
>>>>>When writing these types of apps its important to not presume that the
>>>>>URL will be available. Its good practice to also double check the
>>>>>formatting of the XML, but that's not what's happening here.
>>>>>
>>>>
>>>>The strange thing is, that with 19 of the 20 testusers, it is working
>>>>just fine. But with one user, it keeps on giving this error...
>>>>I believe it must be some kind of setting but I kind find out wich one...
>>>>It isn't the firewall, he doesn't have a proxyserver set, and the server
>>>>works fine, because at the same moment I'm able to connect...
>>>>
>>>>So I'm really stuck...
>>>
>>>
>
Ok, on my pc this works fine... I see two relevant things, one GET /URL
HTTP/1.1
and one return: HTTP/1.1 200 OK[Unreassembled Packet] with 50 packets or
so following from the same source and with the same destination saying:
Continuation or non-HTTP traffic...

I will try and do the same with the person where it doesn't work, and
I'll let you know the outcome...

Thanks for your cooperation

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 05:19:41 CST 2005

Please note that you can save the captured packets (just use the default
format) so you can compare later on.

In the end you should find a difference somewhere between the captured
packets. That should give you a hint on what is wrong.

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16eal$1oe$1@ikaria.belnet.be...
> at wrote:
>> Run ethereal, select Capture/Start from the menu, select an interface
>> (you see the drop down on top of the ethereal screen?) (I always choose
>> my netcard to catch anything) and click ok. That is what I do and here it
>> works. When I click stop it displays what it caught (if anything, you can
>> test by browsisng to some page somewhere). Client/server side doesn't
>> matter.
>>
>> Any luck?
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d16agn$v0q$1@ikaria.belnet.be...
>>
>>>I'm not that familiar with ethereal, but I tried installing it (and
>>>wincap3.1) on my pc... But when I run my program, it doesn't seem to
>>>catpure anything...
>>>I don't have to run it on the server pc do I?
>>>
>>>There is always the problem to make a program like this run on someone
>>>elses pc, especially when he's living in Romania...
>>>
>>>thx for you help
>>>
>>>
>>>at wrote:
>>>
>>>>What difference does ethereal show between a successfull and a failed
>>>>attempt?
>>>>
>>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>news:d168e0$tho$1@ikaria.belnet.be...
>>>>
>>>>
>>>>>Mezzrow wrote:
>>>>>
>>>>>
>>>>>>Yep.
>>>>>>When writing these types of apps its important to not presume that the
>>>>>>URL will be available. Its good practice to also double check the
>>>>>>formatting of the XML, but that's not what's happening here.
>>>>>>
>>>>>
>>>>>The strange thing is, that with 19 of the 20 testusers, it is working
>>>>>just fine. But with one user, it keeps on giving this error...
>>>>>I believe it must be some kind of setting but I kind find out wich
>>>>>one...
>>>>>It isn't the firewall, he doesn't have a proxyserver set, and the
>>>>>server works fine, because at the same moment I'm able to connect...
>>>>>
>>>>>So I'm really stuck...
>>>>
>>>>
>>
> Ok, on my pc this works fine... I see two relevant things, one GET /URL
> HTTP/1.1
> and one return: HTTP/1.1 200 OK[Unreassembled Packet] with 50 packets or
> so following from the same source and with the same destination saying:
> Continuation or non-HTTP traffic...
>
> I will try and do the same with the person where it doesn't work, and I'll
> let you know the outcome...
>
> Thanks for your cooperation



Re: Problem: The underlying connection was closed: Unable to connect to the remote server by Landi

Landi
Tue Mar 15 07:46:03 CST 2005

You are not going to catch anything with Ethereal. He is not having any
communication with the server at all and that is why his code is throwing an
exception. Even if there is anything showing up on the log he probably wont
know what to look for.
--
info@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d148vq$ksn$1@ikaria.belnet.be...
> Hello,
>
> I'm developing a C# - windows forms application. To get some information
> for my application, I'm connecting to an URL, wich gives me XML
> generated using php.
> With 90% of the users, this code just works fine:
>
> [code]
>
> WebRequest request = WebRequest.Create(URL);
>
> try
> {
> request.Timeout = 50000;
> WebResponse response = request.GetResponse();
> }
> catch(Exception ex)
> {
> WriteToLog(LogType.Info,ex.Message.ToString());
> response = null;
> }
>
> [/code]
>
> But with some users, I get an exception saying: The underlying
> connection was closed: Unable to connect to the remote server
>
> I'm sure that there is no firewall on, and I've asked the user to
> disable any proxy settings...
>
> Is there something that I'm overseeing or that can be improved to this
code?
>
>
> thanks in advance,
>
> Kristof



Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 07:54:41 CST 2005

Very constructive...not.

Some clients work, another one does not. What is the difference between the
packets being send from the working clients and the one that does not work?

At least I am interested to know.

"Landi" <info@dowhileloop.com> wrote in message
news:%23GrkWVWKFHA.1396@TK2MSFTNGP10.phx.gbl...
> You are not going to catch anything with Ethereal. He is not having any
> communication with the server at all and that is why his code is throwing
> an
> exception. Even if there is anything showing up on the log he probably
> wont
> know what to look for.
> --
> info@dowhileloop.com
> http://dowhileloop.com website development
> http://publicjoe.dowhileloop.com -- C# Tutorials
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d148vq$ksn$1@ikaria.belnet.be...
>> Hello,
>>
>> I'm developing a C# - windows forms application. To get some information
>> for my application, I'm connecting to an URL, wich gives me XML
>> generated using php.
>> With 90% of the users, this code just works fine:
>>
>> [code]
>>
>> WebRequest request = WebRequest.Create(URL);
>>
>> try
>> {
>> request.Timeout = 50000;
>> WebResponse response = request.GetResponse();
>> }
>> catch(Exception ex)
>> {
>> WriteToLog(LogType.Info,ex.Message.ToString());
>> response = null;
>> }
>>
>> [/code]
>>
>> But with some users, I get an exception saying: The underlying
>> connection was closed: Unable to connect to the remote server
>>
>> I'm sure that there is no firewall on, and I've asked the user to
>> disable any proxy settings...
>>
>> Is there something that I'm overseeing or that can be improved to this
> code?
>>
>>
>> thanks in advance,
>>
>> Kristof
>
>



Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 08:06:04 CST 2005

Landi wrote:
> You are not going to catch anything with Ethereal. He is not having any
> communication with the server at all and that is why his code is throwing an
> exception. Even if there is anything showing up on the log he probably wont
> know what to look for.

The question remains, why isn't there any communication?
It is possible to use a browser, IE or any other, to go to the URL from
the pc where the program throws an exception at the exact same moment...
So it seems to me, the server is just doing fine, but the client pc is
blocking the request/response for an unknown reason...


Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 08:16:50 CST 2005

What is the url? String, uri?

What do you get in s?

string s;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response;
try
{
response = (HttpWebResponse)request.GetResponse();
response.Close();
}
catch(Exception ex)
{
s = ex.ToString();
WriteToLog(LogType.Info, s);
}
response = null;


"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16q4c$93a$1@ikaria.belnet.be...
> Landi wrote:
>> You are not going to catch anything with Ethereal. He is not having any
>> communication with the server at all and that is why his code is throwing
>> an
>> exception. Even if there is anything showing up on the log he probably
>> wont
>> know what to look for.
>
> The question remains, why isn't there any communication?
> It is possible to use a browser, IE or any other, to go to the URL from
> the pc where the program throws an exception at the exact same moment...
> So it seems to me, the server is just doing fine, but the client pc is
> blocking the request/response for an unknown reason...
>



Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 08:22:34 CST 2005

at wrote:
> What is the url? String, uri?
>
> What do you get in s?
>
> string s;
> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
> HttpWebResponse response;
> try
> {
> response = (HttpWebResponse)request.GetResponse();
> response.Close();
> }
> catch(Exception ex)
> {
> s = ex.ToString();
> WriteToLog(LogType.Info, s);
> }
> response = null;
>
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d16q4c$93a$1@ikaria.belnet.be...
>
>>Landi wrote:
>>
>>>You are not going to catch anything with Ethereal. He is not having any
>>>communication with the server at all and that is why his code is throwing
>>>an
>>>exception. Even if there is anything showing up on the log he probably
>>>wont
>>>know what to look for.
>>
>>The question remains, why isn't there any communication?
>>It is possible to use a browser, IE or any other, to go to the URL from
>>the pc where the program throws an exception at the exact same moment...
>>So it seems to me, the server is just doing fine, but the client pc is
>>blocking the request/response for an unknown reason...
>>
>
>
>
The url is
http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup

The exception I'm getting is "The underlying connection was closed:
Unable to connect to the remote server."
And right after that: System.NullReferenceException: Object reference
not set to an instance of an object.
I don't see where the second exception comes from...

The exact code is this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response=null;
try
{
response = (HttpWebResponse)request.GetResponse();
response.Close();
}
catch(Exception ex)
{
WriteToLog(LogType.Info, ex.ToString());
}

if(response == null)
{
CGlobals.WriteToLog(LogType.Info,"Response = NULL");
//He's not coming here...
timeOut = true;
}

XHTML = "";
if(!timeOut)
{
StreamReader reader = new treamReader(response.GetResponseStream());
XHTML = reader.ReadToEnd();
}


BTW: Thanks for your patient help...

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 08:34:16 CST 2005

If you use ethereal on the serverside and run a working client, do you see
any cookie stuff in the received http headers? It looks to me the client
that does not work does not send cookie. It is my assumption that a cookie
should be passed as part of the request.

If you are unable to sit behind the server, check cookie settings on the
client.

Or, use I.E. from the failing client and see what headers get send.

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16r3a$9tj$1@ikaria.belnet.be...
> at wrote:
>> What is the url? String, uri?
>>
>> What do you get in s?
>>
>> string s;
>> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>> HttpWebResponse response;
>> try
>> {
>> response = (HttpWebResponse)request.GetResponse();
>> response.Close();
>> }
>> catch(Exception ex)
>> {
>> s = ex.ToString();
>> WriteToLog(LogType.Info, s);
>> }
>> response = null;
>>
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d16q4c$93a$1@ikaria.belnet.be...
>>
>>>Landi wrote:
>>>
>>>>You are not going to catch anything with Ethereal. He is not having any
>>>>communication with the server at all and that is why his code is
>>>>throwing an
>>>>exception. Even if there is anything showing up on the log he probably
>>>>wont
>>>>know what to look for.
>>>
>>>The question remains, why isn't there any communication?
>>>It is possible to use a browser, IE or any other, to go to the URL from
>>>the pc where the program throws an exception at the exact same moment...
>>>So it seems to me, the server is just doing fine, but the client pc is
>>>blocking the request/response for an unknown reason...
>>>
>>
>>
>>
> The url is
> http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>
> The exception I'm getting is "The underlying connection was closed: Unable
> to connect to the remote server."
> And right after that: System.NullReferenceException: Object reference not
> set to an instance of an object.
> I don't see where the second exception comes from...
>
> The exact code is this:
>
> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
> HttpWebResponse response=null;
> try
> {
> response = (HttpWebResponse)request.GetResponse();
> response.Close();
> }
> catch(Exception ex)
> {
> WriteToLog(LogType.Info, ex.ToString());
> }
>
> if(response == null)
> {
> CGlobals.WriteToLog(LogType.Info,"Response = NULL");
> //He's not coming here...
> timeOut = true;
> }
>
> XHTML = "";
> if(!timeOut)
> {
> StreamReader reader = new treamReader(response.GetResponseStream());
> XHTML = reader.ReadToEnd();
> }
>
>
> BTW: Thanks for your patient help...



Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 08:45:26 CST 2005

I don't own the server, so running ethereal there is a problem...
Running ethereal on the failing client isn't easy neither, because the
failing client situates in Romania, while I'm from Belgium...

But when I try to change my IE settings, and block all cookies,
everything keeps working... Even browsing to the url with IE...

Tricky problem :S

at wrote:
> If you use ethereal on the serverside and run a working client, do you see
> any cookie stuff in the received http headers? It looks to me the client
> that does not work does not send cookie. It is my assumption that a cookie
> should be passed as part of the request.
>
> If you are unable to sit behind the server, check cookie settings on the
> client.
>
> Or, use I.E. from the failing client and see what headers get send.
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d16r3a$9tj$1@ikaria.belnet.be...
>
>>at wrote:
>>
>>>What is the url? String, uri?
>>>
>>>What do you get in s?
>>>
>>>string s;
>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>HttpWebResponse response;
>>>try
>>>{
>>> response = (HttpWebResponse)request.GetResponse();
>>> response.Close();
>>>}
>>>catch(Exception ex)
>>>{
>>> s = ex.ToString();
>>> WriteToLog(LogType.Info, s);
>>>}
>>>response = null;
>>>
>>>
>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>news:d16q4c$93a$1@ikaria.belnet.be...
>>>
>>>
>>>>Landi wrote:
>>>>
>>>>
>>>>>You are not going to catch anything with Ethereal. He is not having any
>>>>>communication with the server at all and that is why his code is
>>>>>throwing an
>>>>>exception. Even if there is anything showing up on the log he probably
>>>>>wont
>>>>>know what to look for.
>>>>
>>>>The question remains, why isn't there any communication?
>>>>It is possible to use a browser, IE or any other, to go to the URL from
>>>>the pc where the program throws an exception at the exact same moment...
>>>>So it seems to me, the server is just doing fine, but the client pc is
>>>>blocking the request/response for an unknown reason...
>>>>
>>>
>>>
>>>
>>The url is
>>http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>>
>>The exception I'm getting is "The underlying connection was closed: Unable
>>to connect to the remote server."
>>And right after that: System.NullReferenceException: Object reference not
>>set to an instance of an object.
>>I don't see where the second exception comes from...
>>
>>The exact code is this:
>>
>> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>> HttpWebResponse response=null;
>> try
>> {
>> response = (HttpWebResponse)request.GetResponse();
>> response.Close();
>> }
>> catch(Exception ex)
>> {
>> WriteToLog(LogType.Info, ex.ToString());
>> }
>>
>> if(response == null)
>> {
>>CGlobals.WriteToLog(LogType.Info,"Response = NULL");
>>//He's not coming here...
>>timeOut = true;
>> }
>>
>> XHTML = "";
>> if(!timeOut)
>> {
>> StreamReader reader = new treamReader(response.GetResponseStream());
>> XHTML = reader.ReadToEnd();
>> }
>>
>>
>>BTW: Thanks for your patient help...
>
>
>

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 08:55:22 CST 2005

That makes it rather difficult! But...

Can you have the client person in Romania use a http logging proxy? So that
you can get at the headers being send? Do you run a client yourself as well
by the way? Do you get the headers it sends?


"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16se6$ari$1@ikaria.belnet.be...
>I don't own the server, so running ethereal there is a problem... Running
>ethereal on the failing client isn't easy neither, because the failing
>client situates in Romania, while I'm from Belgium...
>
> But when I try to change my IE settings, and block all cookies, everything
> keeps working... Even browsing to the url with IE...
>
> Tricky problem :S
>
> at wrote:
>> If you use ethereal on the serverside and run a working client, do you
>> see any cookie stuff in the received http headers? It looks to me the
>> client that does not work does not send cookie. It is my assumption that
>> a cookie should be passed as part of the request.
>>
>> If you are unable to sit behind the server, check cookie settings on the
>> client.
>>
>> Or, use I.E. from the failing client and see what headers get send.
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d16r3a$9tj$1@ikaria.belnet.be...
>>
>>>at wrote:
>>>
>>>>What is the url? String, uri?
>>>>
>>>>What do you get in s?
>>>>
>>>>string s;
>>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>HttpWebResponse response;
>>>>try
>>>>{
>>>> response = (HttpWebResponse)request.GetResponse();
>>>> response.Close();
>>>>}
>>>>catch(Exception ex)
>>>>{
>>>> s = ex.ToString();
>>>> WriteToLog(LogType.Info, s);
>>>>}
>>>>response = null;
>>>>
>>>>
>>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>news:d16q4c$93a$1@ikaria.belnet.be...
>>>>
>>>>
>>>>>Landi wrote:
>>>>>
>>>>>
>>>>>>You are not going to catch anything with Ethereal. He is not having
>>>>>>any
>>>>>>communication with the server at all and that is why his code is
>>>>>>throwing an
>>>>>>exception. Even if there is anything showing up on the log he
>>>>>>probably wont
>>>>>>know what to look for.
>>>>>
>>>>>The question remains, why isn't there any communication?
>>>>>It is possible to use a browser, IE or any other, to go to the URL from
>>>>>the pc where the program throws an exception at the exact same
>>>>>moment...
>>>>>So it seems to me, the server is just doing fine, but the client pc is
>>>>>blocking the request/response for an unknown reason...
>>>>>
>>>>
>>>>
>>>>
>>>The url is
>>>http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>>>
>>>The exception I'm getting is "The underlying connection was closed:
>>>Unable to connect to the remote server."
>>>And right after that: System.NullReferenceException: Object reference
>>>not set to an instance of an object.
>>>I don't see where the second exception comes from...
>>>
>>>The exact code is this:
>>>
>>> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>> HttpWebResponse response=null;
>>> try
>>> {
>>> response = (HttpWebResponse)request.GetResponse();
>>> response.Close();
>>> }
>>> catch(Exception ex)
>>> {
>>> WriteToLog(LogType.Info, ex.ToString());
>>> }
>>>
>>> if(response == null)
>>> {
>>>CGlobals.WriteToLog(LogType.Info,"Response = NULL");
>>>//He's not coming here...
>>>timeOut = true;
>>> }
>>>
>>> XHTML = "";
>>> if(!timeOut)
>>> {
>>> StreamReader reader = new treamReader(response.GetResponseStream());
>>> XHTML = reader.ReadToEnd();
>>> }
>>>
>>>
>>>BTW: Thanks for your patient help...
>>
>>


Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 08:55:24 CST 2005

I'm sorry for my stupidity, but I don't know exactly what you are
talking about... I'm not using a http logging proxy, but where can I
download something like that and how can I use it? What does it do exactly?

thx

at wrote:
> That makes it rather difficult! But...
>
> Can you have the client person in Romania use a http logging proxy? So that
> you can get at the headers being send? Do you run a client yourself as well
> by the way? Do you get the headers it sends?
>
>
> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
> news:d16se6$ari$1@ikaria.belnet.be...
>
>>I don't own the server, so running ethereal there is a problem... Running
>>ethereal on the failing client isn't easy neither, because the failing
>>client situates in Romania, while I'm from Belgium...
>>
>>But when I try to change my IE settings, and block all cookies, everything
>>keeps working... Even browsing to the url with IE...
>>
>>Tricky problem :S
>>
>>at wrote:
>>
>>>If you use ethereal on the serverside and run a working client, do you
>>>see any cookie stuff in the received http headers? It looks to me the
>>>client that does not work does not send cookie. It is my assumption that
>>>a cookie should be passed as part of the request.
>>>
>>>If you are unable to sit behind the server, check cookie settings on the
>>>client.
>>>
>>>Or, use I.E. from the failing client and see what headers get send.
>>>
>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>news:d16r3a$9tj$1@ikaria.belnet.be...
>>>
>>>
>>>>at wrote:
>>>>
>>>>
>>>>>What is the url? String, uri?
>>>>>
>>>>>What do you get in s?
>>>>>
>>>>>string s;
>>>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>>HttpWebResponse response;
>>>>>try
>>>>>{
>>>>>response = (HttpWebResponse)request.GetResponse();
>>>>>response.Close();
>>>>>}
>>>>>catch(Exception ex)
>>>>>{
>>>>>s = ex.ToString();
>>>>>WriteToLog(LogType.Info, s);
>>>>>}
>>>>>response = null;
>>>>>
>>>>>
>>>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>>news:d16q4c$93a$1@ikaria.belnet.be...
>>>>>
>>>>>
>>>>>
>>>>>>Landi wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>You are not going to catch anything with Ethereal. He is not having
>>>>>>>any
>>>>>>>communication with the server at all and that is why his code is
>>>>>>>throwing an
>>>>>>>exception. Even if there is anything showing up on the log he
>>>>>>>probably wont
>>>>>>>know what to look for.
>>>>>>
>>>>>>The question remains, why isn't there any communication?
>>>>>>It is possible to use a browser, IE or any other, to go to the URL from
>>>>>>the pc where the program throws an exception at the exact same
>>>>>>moment...
>>>>>>So it seems to me, the server is just doing fine, but the client pc is
>>>>>>blocking the request/response for an unknown reason...
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>The url is
>>>>http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>>>>
>>>>The exception I'm getting is "The underlying connection was closed:
>>>>Unable to connect to the remote server."
>>>>And right after that: System.NullReferenceException: Object reference
>>>>not set to an instance of an object.
>>>>I don't see where the second exception comes from...
>>>>
>>>>The exact code is this:
>>>>
>>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>HttpWebResponse response=null;
>>>>try
>>>>{
>>>> response = (HttpWebResponse)request.GetResponse();
>>>> response.Close();
>>>>}
>>>>catch(Exception ex)
>>>>{
>>>> WriteToLog(LogType.Info, ex.ToString());
>>>>}
>>>>
>>>>if(response == null)
>>>>{
>>>>CGlobals.WriteToLog(LogType.Info,"Response = NULL");
>>>>//He's not coming here...
>>>>timeOut = true;
>>>>}
>>>>
>>>>XHTML = "";
>>>>if(!timeOut)
>>>>{
>>>> StreamReader reader = new treamReader(response.GetResponseStream());
>>>> XHTML = reader.ReadToEnd();
>>>>}
>>>>
>>>>
>>>>BTW: Thanks for your patient help...
>>>
>>>
>

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 09:04:42 CST 2005

A proxy forwards requests and responses between client and server. In the
process it can save a copy of what is being send including the headers.

Client normally connect to port 80 (HTPP). When a proxy is started it
listens on another port so the client has to connect to that other port for
web access. The proxy than forwards to the target on port 80 and vice versa.
It is like a bridge. On the bridge there is a person seeing all who pass.

There are several proxies available for download on the web. Just get some
and see if you can get then running on your own machine. Once you have found
one you like (that saves headers for you) and know how it operates you can
let your Romanian customers use it.

"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
news:d16t0s$ari$2@ikaria.belnet.be...
> I'm sorry for my stupidity, but I don't know exactly what you are talking
> about... I'm not using a http logging proxy, but where can I download
> something like that and how can I use it? What does it do exactly?
>
> thx
>
> at wrote:
>> That makes it rather difficult! But...
>>
>> Can you have the client person in Romania use a http logging proxy? So
>> that you can get at the headers being send? Do you run a client yourself
>> as well by the way? Do you get the headers it sends?
>>
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d16se6$ari$1@ikaria.belnet.be...
>>
>>>I don't own the server, so running ethereal there is a problem... Running
>>>ethereal on the failing client isn't easy neither, because the failing
>>>client situates in Romania, while I'm from Belgium...
>>>
>>>But when I try to change my IE settings, and block all cookies,
>>>everything keeps working... Even browsing to the url with IE...
>>>
>>>Tricky problem :S
>>>
>>>at wrote:
>>>
>>>>If you use ethereal on the serverside and run a working client, do you
>>>>see any cookie stuff in the received http headers? It looks to me the
>>>>client that does not work does not send cookie. It is my assumption that
>>>>a cookie should be passed as part of the request.
>>>>
>>>>If you are unable to sit behind the server, check cookie settings on the
>>>>client.
>>>>
>>>>Or, use I.E. from the failing client and see what headers get send.
>>>>
>>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>news:d16r3a$9tj$1@ikaria.belnet.be...
>>>>
>>>>
>>>>>at wrote:
>>>>>
>>>>>
>>>>>>What is the url? String, uri?
>>>>>>
>>>>>>What do you get in s?
>>>>>>
>>>>>>string s;
>>>>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>>>HttpWebResponse response;
>>>>>>try
>>>>>>{
>>>>>>response = (HttpWebResponse)request.GetResponse();
>>>>>>response.Close();
>>>>>>}
>>>>>>catch(Exception ex)
>>>>>>{
>>>>>>s = ex.ToString();
>>>>>>WriteToLog(LogType.Info, s);
>>>>>>}
>>>>>>response = null;
>>>>>>
>>>>>>
>>>>>>"Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>>>news:d16q4c$93a$1@ikaria.belnet.be...
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Landi wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>You are not going to catch anything with Ethereal. He is not having
>>>>>>>>any
>>>>>>>>communication with the server at all and that is why his code is
>>>>>>>>throwing an
>>>>>>>>exception. Even if there is anything showing up on the log he
>>>>>>>>probably wont
>>>>>>>>know what to look for.
>>>>>>>
>>>>>>>The question remains, why isn't there any communication?
>>>>>>>It is possible to use a browser, IE or any other, to go to the URL
>>>>>>>from the pc where the program throws an exception at the exact same
>>>>>>>moment...
>>>>>>>So it seems to me, the server is just doing fine, but the client pc
>>>>>>>is blocking the request/response for an unknown reason...
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>The url is
>>>>>http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>>>>>
>>>>>The exception I'm getting is "The underlying connection was closed:
>>>>>Unable to connect to the remote server."
>>>>>And right after that: System.NullReferenceException: Object reference
>>>>>not set to an instance of an object.
>>>>>I don't see where the second exception comes from...
>>>>>
>>>>>The exact code is this:
>>>>>
>>>>>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>>HttpWebResponse response=null;
>>>>>try
>>>>>{
>>>>> response = (HttpWebResponse)request.GetResponse();
>>>>> response.Close();
>>>>>}
>>>>>catch(Exception ex)
>>>>>{
>>>>> WriteToLog(LogType.Info, ex.ToString());
>>>>>}
>>>>>
>>>>>if(response == null)
>>>>>{
>>>>>CGlobals.WriteToLog(LogType.Info,"Response = NULL");
>>>>>//He's not coming here...
>>>>>timeOut = true;
>>>>>}
>>>>>
>>>>>XHTML = "";
>>>>>if(!timeOut)
>>>>>{
>>>>> StreamReader reader = new treamReader(response.GetResponseStream());
>>>>> XHTML = reader.ReadToEnd();
>>>>>}
>>>>>
>>>>>
>>>>>BTW: Thanks for your patient help...
>>>>
>>>>
>>



Re: Problem: The underlying connection was closed: Unable to connect by Kristof

Kristof
Tue Mar 15 09:05:42 CST 2005

Unbelievable,

I just had contact with my Romanian friend... He installed ethereal and
tried it... And the program just worked...
The only thing I did was to save the generated xml in utf-8,
yesterday... That must have been the solution...

Very strange,

But thank you all for trying to help me on this one...
If you are in Belgium sometime, give me a call, I'll buy you a drink :D

ciao


Kristof Thys wrote:
> I'm sorry for my stupidity, but I don't know exactly what you are
> talking about... I'm not using a http logging proxy, but where can I
> download something like that and how can I use it? What does it do exactly?
>
> thx
>
> at wrote:
>
>> That makes it rather difficult! But...
>>
>> Can you have the client person in Romania use a http logging proxy? So
>> that you can get at the headers being send? Do you run a client
>> yourself as well by the way? Do you get the headers it sends?
>>
>>
>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>> news:d16se6$ari$1@ikaria.belnet.be...
>>
>>> I don't own the server, so running ethereal there is a problem...
>>> Running ethereal on the failing client isn't easy neither, because
>>> the failing client situates in Romania, while I'm from Belgium...
>>>
>>> But when I try to change my IE settings, and block all cookies,
>>> everything keeps working... Even browsing to the url with IE...
>>>
>>> Tricky problem :S
>>>
>>> at wrote:
>>>
>>>> If you use ethereal on the serverside and run a working client, do
>>>> you see any cookie stuff in the received http headers? It looks to
>>>> me the client that does not work does not send cookie. It is my
>>>> assumption that a cookie should be passed as part of the request.
>>>>
>>>> If you are unable to sit behind the server, check cookie settings on
>>>> the client.
>>>>
>>>> Or, use I.E. from the failing client and see what headers get send.
>>>>
>>>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>> news:d16r3a$9tj$1@ikaria.belnet.be...
>>>>
>>>>
>>>>> at wrote:
>>>>>
>>>>>
>>>>>> What is the url? String, uri?
>>>>>>
>>>>>> What do you get in s?
>>>>>>
>>>>>> string s;
>>>>>> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>>> HttpWebResponse response;
>>>>>> try
>>>>>> {
>>>>>> response = (HttpWebResponse)request.GetResponse();
>>>>>> response.Close();
>>>>>> }
>>>>>> catch(Exception ex)
>>>>>> {
>>>>>> s = ex.ToString();
>>>>>> WriteToLog(LogType.Info, s);
>>>>>> }
>>>>>> response = null;
>>>>>>
>>>>>>
>>>>>> "Kristof Thys" <Kristof.Thys@luc.ac.be> wrote in message
>>>>>> news:d16q4c$93a$1@ikaria.belnet.be...
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Landi wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> You are not going to catch anything with Ethereal. He is not
>>>>>>>> having any
>>>>>>>> communication with the server at all and that is why his code is
>>>>>>>> throwing an
>>>>>>>> exception. Even if there is anything showing up on the log he
>>>>>>>> probably wont
>>>>>>>> know what to look for.
>>>>>>>
>>>>>>>
>>>>>>> The question remains, why isn't there any communication?
>>>>>>> It is possible to use a browser, IE or any other, to go to the
>>>>>>> URL from the pc where the program throws an exception at the
>>>>>>> exact same moment...
>>>>>>> So it seems to me, the server is just doing fine, but the client
>>>>>>> pc is blocking the request/response for an unknown reason...
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> The url is
>>>>> http://beta.soccerproject.com/man_tool.php?login=OscarCookie&pw=newsgroup
>>>>>
>>>>>
>>>>> The exception I'm getting is "The underlying connection was closed:
>>>>> Unable to connect to the remote server."
>>>>> And right after that: System.NullReferenceException: Object
>>>>> reference not set to an instance of an object.
>>>>> I don't see where the second exception comes from...
>>>>>
>>>>> The exact code is this:
>>>>>
>>>>> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
>>>>> HttpWebResponse response=null;
>>>>> try
>>>>> {
>>>>> response = (HttpWebResponse)request.GetResponse();
>>>>> response.Close();
>>>>> }
>>>>> catch(Exception ex)
>>>>> {
>>>>> WriteToLog(LogType.Info, ex.ToString());
>>>>> }
>>>>>
>>>>> if(response == null)
>>>>> {
>>>>> CGlobals.WriteToLog(LogType.Info,"Response = NULL");
>>>>> //He's not coming here...
>>>>> timeOut = true;
>>>>> }
>>>>>
>>>>> XHTML = "";
>>>>> if(!timeOut)
>>>>> {
>>>>> StreamReader reader = new treamReader(response.GetResponseStream());
>>>>> XHTML = reader.ReadToEnd();
>>>>> }
>>>>>
>>>>>
>>>>> BTW: Thanks for your patient help...
>>>>
>>>>
>>>>
>>

Re: Problem: The underlying connection was closed: Unable to connect to the remote server by at

at
Tue Mar 15 09:14:58 CST 2005

As a matter of fact I am going international coming Friday. I will be in
Brussels the whole day, R