PC Review


Reply
Thread Tools Rate Thread

Connection is automatically closed after receiving "403" from webs

 
 
=?Utf-8?B?YmFyYnV0eg==?=
Guest
Posts: n/a
 
      4th Apr 2006
Hi,
I have a huge problem with HttpWebRequest/HttpWebResponse.
The problem is when i generate a request using HttpWebRequest to a web
server, when the webserver responds with "403 Forbidden" the connection to
the web server is automatically closed by the .net (i guess by
HttpWebResponse instance)!
I trace the packets and i see that although i get from the web server
"Connection: Keep-Alive" header, the .net framework sends tcp Fin to the
webserver. Of course i forgot to mention that i use http 1.1 and just to make
sure i also set the HttpWebRequest.KeepAlive header to true.
The framework seems to close the "persistent" connection only when it gets
"403", if it gets "404" the connection keeps persistent as it should.
I also debug this situation and saw that the connection immediately close
right after the call (HttpWebResponse)request.GetResponse() is done - long
before the code gets to the response.Close() line.
This behaviour is very critical to my application. I must keep persistent
connection with web server at all time (this is http 1.1 !). The webserver
does not send "Connection: close" header and there is no reason to close the
connection with the web server!! By the way, i did the same with IE browser
and IE acts ok (it does not close the connection).

Please help me with this.
Thanks a lot.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?YmFyYnV0eg==?=
Guest
Posts: n/a
 
      4th Apr 2006
Another discovery:
It seems that this problem does not happen in framework 1.1! It happens only
on framework 2.0. Please help me i can go back to 1.1 !

"barbutz" wrote:

> Hi,
> I have a huge problem with HttpWebRequest/HttpWebResponse.
> The problem is when i generate a request using HttpWebRequest to a web
> server, when the webserver responds with "403 Forbidden" the connection to
> the web server is automatically closed by the .net (i guess by
> HttpWebResponse instance)!
> I trace the packets and i see that although i get from the web server
> "Connection: Keep-Alive" header, the .net framework sends tcp Fin to the
> webserver. Of course i forgot to mention that i use http 1.1 and just to make
> sure i also set the HttpWebRequest.KeepAlive header to true.
> The framework seems to close the "persistent" connection only when it gets
> "403", if it gets "404" the connection keeps persistent as it should.
> I also debug this situation and saw that the connection immediately close
> right after the call (HttpWebResponse)request.GetResponse() is done - long
> before the code gets to the response.Close() line.
> This behaviour is very critical to my application. I must keep persistent
> connection with web server at all time (this is http 1.1 !). The webserver
> does not send "Connection: close" header and there is no reason to close the
> connection with the web server!! By the way, i did the same with IE browser
> and IE acts ok (it does not close the connection).
>
> Please help me with this.
> Thanks a lot.

 
Reply With Quote
 
=?Utf-8?B?YmFyYnV0eg==?=
Guest
Posts: n/a
 
      4th Apr 2006
If the application is compiled with framework 1.1 (i had to cut many part of
my code for that) there is no problem and when i compile it with 2.0 the
problem appears. I guess it's a problem of framework 2.0 ?
I'll appriciate any help with that since i cannot go back to framework 1.1.

Thx

"barbutz" wrote:

> Another discovery:
> It seems that this problem does not happen in framework 1.1! It happens only
> on framework 2.0. Please help me i can go back to 1.1 !
>
> "barbutz" wrote:
>
> > Hi,
> > I have a huge problem with HttpWebRequest/HttpWebResponse.
> > The problem is when i generate a request using HttpWebRequest to a web
> > server, when the webserver responds with "403 Forbidden" the connection to
> > the web server is automatically closed by the .net (i guess by
> > HttpWebResponse instance)!
> > I trace the packets and i see that although i get from the web server
> > "Connection: Keep-Alive" header, the .net framework sends tcp Fin to the
> > webserver. Of course i forgot to mention that i use http 1.1 and just to make
> > sure i also set the HttpWebRequest.KeepAlive header to true.
> > The framework seems to close the "persistent" connection only when it gets
> > "403", if it gets "404" the connection keeps persistent as it should.
> > I also debug this situation and saw that the connection immediately close
> > right after the call (HttpWebResponse)request.GetResponse() is done - long
> > before the code gets to the response.Close() line.
> > This behaviour is very critical to my application. I must keep persistent
> > connection with web server at all time (this is http 1.1 !). The webserver
> > does not send "Connection: close" header and there is no reason to close the
> > connection with the web server!! By the way, i did the same with IE browser
> > and IE acts ok (it does not close the connection).
> >
> > Please help me with this.
> > Thanks a lot.

 
Reply With Quote
 
=?Utf-8?B?YmFyYnV0eg==?=
Guest
Posts: n/a
 
      5th Apr 2006
The problem has another major implication (this bug is serious than i
thought!) if you request the same Forbidden url in a loop, a
System.Net.Sockets.SocketException is thrown continuously!! the socket error
code is 10048 which, from Windows Socket 2 docs, is WSAEADDRINUSE - "Address
already in use". I guess the socket resource is not released correctly !
Please can anyone tell me what's going on. i'm sure the bug is within the
framework but do you know this bug? does it have a fix ???
Please!

"barbutz" wrote:

> If the application is compiled with framework 1.1 (i had to cut many part of
> my code for that) there is no problem and when i compile it with 2.0 the
> problem appears. I guess it's a problem of framework 2.0 ?
> I'll appriciate any help with that since i cannot go back to framework 1.1.
>
> Thx
>
> "barbutz" wrote:
>
> > Another discovery:
> > It seems that this problem does not happen in framework 1.1! It happens only
> > on framework 2.0. Please help me i can go back to 1.1 !
> >
> > "barbutz" wrote:
> >
> > > Hi,
> > > I have a huge problem with HttpWebRequest/HttpWebResponse.
> > > The problem is when i generate a request using HttpWebRequest to a web
> > > server, when the webserver responds with "403 Forbidden" the connection to
> > > the web server is automatically closed by the .net (i guess by
> > > HttpWebResponse instance)!
> > > I trace the packets and i see that although i get from the web server
> > > "Connection: Keep-Alive" header, the .net framework sends tcp Fin to the
> > > webserver. Of course i forgot to mention that i use http 1.1 and just to make
> > > sure i also set the HttpWebRequest.KeepAlive header to true.
> > > The framework seems to close the "persistent" connection only when it gets
> > > "403", if it gets "404" the connection keeps persistent as it should.
> > > I also debug this situation and saw that the connection immediately close
> > > right after the call (HttpWebResponse)request.GetResponse() is done - long
> > > before the code gets to the response.Close() line.
> > > This behaviour is very critical to my application. I must keep persistent
> > > connection with web server at all time (this is http 1.1 !). The webserver
> > > does not send "Connection: close" header and there is no reason to close the
> > > connection with the web server!! By the way, i did the same with IE browser
> > > and IE acts ok (it does not close the connection).
> > >
> > > Please help me with this.
> > > Thanks a lot.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving message "Personal Folders not closed correctly" lefebel Microsoft Outlook Discussion 1 23rd Aug 2008 12:27 AM
previous unencountered "The underlying connection was closed" message with HttpWebRequest David Cho Microsoft C# .NET 4 9th Jun 2005 08:51 AM
Hide "Record" "Closed Caption" "Parental Control" indicators while in full screen Jordan ATI Video Cards 0 18th Feb 2005 06:21 PM
error receiving information from fixed IP address "The underlying connection was closed: An unexpected error occurred on a receive." Angel Microsoft C# .NET 1 19th Jan 2004 04:58 AM
Access Problem: "Server error:..." OR "...Client closed connection" Jim Paullin Microsoft Frontpage 1 24th Jul 2003 05:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:28 AM.