473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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

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

Similar topics

0
by: Luis Esteban Valencia | last post by:
I have an application on my intranet It works fine there when I copied the proyect to the server of the Internet it gives me this error. The arquitecture of my servers are. There is one Server...
5
by: David | last post by:
When I call a webservice with an ASP.NET application, I get the following error: "The underlying connection was closed: Unable to connect to the remote server. " With my brower, I can get the...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
1
by: Jim | last post by:
I have the following code: Line 35: Dim sURL As String = "http://www.google.com" Line 36: Dim data As Stream = client.OpenRead(Server.UrlPath­Encode(sURL)) Line 37: ...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
3
by: Monty | last post by:
OK, I had an issue with this and found lots of advice that did not apply, so I'm posting what I found hoping it might help someone else. Here's the sitch: you have a COM app that calls to a .Net...
3
by: nandan | last post by:
Yes. My client has a proxy server. That much i know. In my application I make two kinds of calls that are affected by the proxy server I finally got the webservice call working. But my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.