471,107 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Receiving a web response asynchronously

With the code below, which I copied from the MSDN, I am getting only part of
the the web-page 'MyUrl' returned (this is a synchronoues access).
My hunch is that I have to use asynchronous access, which requires the use
of IAsynchResult - besides other things.
Does anyone have or can anybody point to code for this, please?!
TIA

Dim request As HttpWebRequest = CType(WebRequest.Create(MyUrl),
HttpWebRequest)
' Set some reasonable limits on resources used by this request
request.MaximumAutomaticRedirections =12
request.MaximumResponseHeadersLength = 12
' Set credentials to use for this request.
request.Credentials = CredentialCache.DefaultCredentials
Dim response As HttpWebResponse = CType(request.GetResponse(),
HttpWebResponse,True)

Nov 21 '05 #1
3 1193
August 7, 2005

I doubt that it would make a difference being Async vs Synch. My thought
is maybe the web request is timing out before the full request is filled and
the partial request is sent back. Or maybe there is something in the
HTML|Code returned that makes it think that it is done? Hope this helps and
have a great day!

--
Joseph Bittman
Microsoft Certified Solution Developer

Web Site: http://71.39.42.23
Static IP


"PeterK" <p.*****@verizon.net> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
With the code below, which I copied from the MSDN, I am getting only part
of
the the web-page 'MyUrl' returned (this is a synchronoues access).
My hunch is that I have to use asynchronous access, which requires the use
of IAsynchResult - besides other things.
Does anyone have or can anybody point to code for this, please?!
TIA

Dim request As HttpWebRequest = CType(WebRequest.Create(MyUrl),
HttpWebRequest)
' Set some reasonable limits on resources used by this request
request.MaximumAutomaticRedirections =12
request.MaximumResponseHeadersLength = 12
' Set credentials to use for this request.
request.Credentials = CredentialCache.DefaultCredentials
Dim response As HttpWebResponse = CType(request.GetResponse(),
HttpWebResponse,True)

Nov 21 '05 #2
Yes, that helped: The URL had a wrong parameter which made it get a shorter
response.
The question that remains, though, is:"If the web request (this client)
times out, how to lengthen the timeout interval?".
In which cases would an aysnchronous connection be needed?
Thank you.
"Joseph Bittman MCSD" <Ry*********@msn.com> wrote in message
news:O3**************@TK2MSFTNGP14.phx.gbl...
August 7, 2005

I doubt that it would make a difference being Async vs Synch. My thought is maybe the web request is timing out before the full request is filled and the partial request is sent back. Or maybe there is something in the
HTML|Code returned that makes it think that it is done? Hope this helps and have a great day!

--
Joseph Bittman
Microsoft Certified Solution Developer

Web Site: http://71.39.42.23
Static IP


"PeterK" <p.*****@verizon.net> wrote in message
news:ON**************@TK2MSFTNGP14.phx.gbl...
With the code below, which I copied from the MSDN, I am getting only part of
the the web-page 'MyUrl' returned (this is a synchronoues access).
My hunch is that I have to use asynchronous access, which requires the use of IAsynchResult - besides other things.
Does anyone have or can anybody point to code for this, please?!
TIA

Dim request As HttpWebRequest = CType(WebRequest.Create(MyUrl),
HttpWebRequest)
' Set some reasonable limits on resources used by this request
request.MaximumAutomaticRedirections =12
request.MaximumResponseHeadersLength = 12
' Set credentials to use for this request.
request.Credentials = CredentialCache.DefaultCredentials
Dim response As HttpWebResponse = CType(request.GetResponse(),
HttpWebResponse,True)


Nov 21 '05 #3
> The question that remains, though, is:"If the web request (this client)
times out, how to lengthen the timeout interval?".


request.Timeout = 30000 ' 30 seconds

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Carter | last post: by
5 posts views Thread by Danny | last post: by
reply views Thread by Danny | last post: by

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.