Re: Problems with HttpWebRequest
- From: Oliver <Oliver@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 2 Oct 2005 23:13:02 -0700
I now see that the url returns a HTTP/1.0 200 Simple Response, where as other
urls that i have tried with the HttpWebRequest returns a HTTP/1.1 200 OK
response. Could this 'Simple Response' be the problem ?
"Scott Allen" wrote:
> Does the initial request cause a redirect to a default page?
> You might want to set AllowAutoRedirect to false and see what happens.
> I know you said the server does not return a header, but a redirect
> would cause 2 requests fromt the client.
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Sun, 2 Oct 2005 09:24:02 -0700, Oliver
> <Oliver@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >I have a very wired problem requesting one specific url from within my
> >application.
> >
> >I have struggeled with this for 5 hours now, and searched google withour any
> >luck, so i hope that someone are able to help me.
> >
> >Here is the code that i am using:
> >
> >Dim url As String = "MyIP"
> >Dim httpRequest As HttpWebRequest = CType(WebRequest.Create(url),
> >HttpWebRequest)
> >Dim httpResponse As HttpWebResponse = CType(httpRequest.GetResponse,
> >HttpWebResponse)
> >
> >The erro that i get is the following:
> >
> >"The underlying connection was closed: An unexpected error occurred on a
> >receive."
> >
> >Then i downloaded HTTP Analyzer to see what was going on behind the scenes.
> >
> >When requesting the url from within IE, the content is returned to the
> >browser windows without any problems, but when the request is made using a
> >HttpWebRequest strange things happen.
> >
> >When i monitor what i happening in HTTP Analyser is see that the request is
> >made from my asp.net program, and the content and a status 200 is returned,
> >BUT about 500 miliseconds later another request is made to the resource (i
> >can see that in the monitor program) and this time no content is returned.
> >This is probabaly why the the framework see this as a malformed response, and
> >i get the error above.
> >
> >I have tested the code with 10-15 other addresses with success. The content
> >is returned, and the resoruce is only requested 1 time. Has anyone seen this
> >before ?
> >
> >What is a little bit special about the resource that i request is that the
> >content is returned with no header info at all, only raw text, but why should
> >this mean that the resource is accessed two times, when i only call
> >httpRequest.GetResponse one time.
> >
> >The resource that i access is a simple url hosted on a Apace server which
> >retuns a text string with no header info at all.
> >
> >I hope that someone can help me on this, as i think i have tested for
> >everything.
> >
> >thanks,
> >Oliver
>
>
.
- Follow-Ups:
- Re: Problems with HttpWebRequest
- From: Oliver
- Re: Problems with HttpWebRequest
- Prev by Date: Re: Windows Service not installing.
- Next by Date: Re: Problems with HttpWebRequest
- Previous by thread: Re: Why popup window will be re-opened again after closing it?
- Next by thread: Re: Problems with HttpWebRequest
- Index(es):
Relevant Pages
|