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

Problem: The underlying connection was closed: Unable to connectto the remote server

P: n/a
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:

Expand|Select|Wrap|Line Numbers
  1.  
  2. WebRequest request = WebRequest.Create(URL);
  3.  
  4. try
  5. {
  6. request.Timeout = 50000;
  7. WebResponse response = request.GetResponse();
  8. }
  9. catch(Exception ex)
  10. {
  11. WriteToLog(LogType.Info,ex.Message.ToString());
  12. response = null;
  13. }
  14.  
  15.  
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
Nov 16 '05 #1
Share this Question
Share on Google+
22 Replies


P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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:

Expand|Select|Wrap|Line Numbers
  1.  WebRequest request = WebRequest.Create(URL);
  2.  try
  3.  {
  4.  request.Timeout = 50000;
  5.  WebResponse response = request.GetResponse();
  6.  }
  7.  catch(Exception ex)
  8.  {
  9.  WriteToLog(LogType.Info,ex.Message.ToString());
  10.  response = null; }
  11.  

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

Nov 16 '05 #2

P: n/a
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.

--
in**@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials
"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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:

Expand|Select|Wrap|Line Numbers
  1.  WebRequest request = WebRequest.Create(URL);
  2.  try
  3.  {
  4.  request.Timeout = 50000;
  5.  WebResponse response = request.GetResponse();
  6.  }
  7.  catch(Exception ex)
  8.  {
  9.  WriteToLog(LogType.Info,ex.Message.ToString());
  10.  response = null;
  11.  }
  12.  

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

Nov 16 '05 #3

P: n/a
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.

Nov 16 '05 #4

P: n/a
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...
Nov 16 '05 #5

P: n/a
at
What difference does ethereal show between a successfull and a failed
attempt?

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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...

Nov 16 '05 #6

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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...


Nov 16 '05 #7

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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...



Nov 16 '05 #8

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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
Nov 16 '05 #9

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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

Nov 16 '05 #10

P: n/a
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.
--
in**@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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:

Expand|Select|Wrap|Line Numbers
  1.  WebRequest request = WebRequest.Create(URL);
  2.  try
  3.  {
  4.  request.Timeout = 50000;
  5.  WebResponse response = request.GetResponse();
  6.  }
  7.  catch(Exception ex)
  8.  {
  9.  WriteToLog(LogType.Info,ex.Message.ToString());
  10.  response = null;
  11.  }
  12.  

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

Nov 16 '05 #11

P: n/a
at
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" <in**@dowhileloop.com> wrote in message
news:%2****************@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.
--
in**@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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:

Expand|Select|Wrap|Line Numbers
  1.  WebRequest request = WebRequest.Create(URL);
  2.  try
  3.  {
  4.  request.Timeout = 50000;
  5.  WebResponse response = request.GetResponse();
  6.  }
  7.  catch(Exception ex)
  8.  {
  9.  WriteToLog(LogType.Info,ex.Message.ToString());
  10.  response = null;
  11.  }
  12.  

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


Nov 16 '05 #12

P: n/a
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...

Nov 16 '05 #13

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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...

Nov 16 '05 #14

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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_to...e&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...
Nov 16 '05 #15

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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_to...e&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...

Nov 16 '05 #16

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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_to...e&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...


Nov 16 '05 #17

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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_to...e&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...



Nov 16 '05 #18

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>news:d1**********@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_to...e&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...

Nov 16 '05 #19

P: n/a
at
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>>news:d1**********@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_to...e&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...

Nov 16 '05 #20

P: n/a
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>> news:d1**********@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_to...e&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...

Nov 16 '05 #21

P: n/a
at
As a matter of fact I am going international coming Friday. I will be in
Brussels the whole day, Rue de Hennin.

Anyway, I take it the problem is solved? If so, I don't get it but that does
not matter ;-)

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@ikaria.belnet.be...
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
> news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>>> news:d1**********@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_to...e&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...
>
>
>

Nov 16 '05 #22

P: n/a
at
This just appeared on codeproject:
http://www.codeproject.com/csharp/HTTPeep.asp

"at" <a@t> wrote in message news:42***********************@news.xs4all.nl...
As a matter of fact I am going international coming Friday. I will be in
Brussels the whole day, Rue de Hennin.

Anyway, I take it the problem is solved? If so, I don't get it but that
does not matter ;-)

"Kristof Thys" <Kr**********@luc.ac.be> wrote in message
news:d1**********@ikaria.belnet.be...
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" <Kr**********@luc.ac.be> wrote in message
news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>> news:d1**********@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" <Kr**********@luc.ac.be> wrote in message
>>>> news:d1**********@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_to...e&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...
>>
>>
>>


Nov 16 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.