Multimobile Development: Building Applications for any Smartphone
BUG FOUND IN FRAMEWORK: HttpWebRequest Class
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.


Sam Hulick
(Remove the XYZ from my email address to email me)

Hopefully I'm not just doing something stupid.. if I am, I apologize. I'm
trying to fetch pages using HttpWebRequest. Most pages work fine. Some
lock up. Here's the code:

HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(txtURL.Text);
wr.AllowAutoRedirect = true;
wr.MaximumAutomaticRedirections = 50;
wr.Timeout = 5000;
wr = (HttpWebRequest)WebRequest.Create(txtURL.Text);
WebResponse resp = wr.GetResponse();
Stream webstream = resp.GetResponseStream();

Anyway, it locks up on the wr.GetResponse(). These sites work fine:

http://www.msn.com/
http://www.amazon.com/

These sites lock up the app:

http://www.ameritech.net/
http://www.msnbc.com/

The other odd thing is, the Timeout of 5000 ms is totally ignored.

So is this a bug in the Framework? Anyone know why this happens?

Thanks,

Sam

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Enriko Riba
Hi Sam,

You are overwritting your wr object!

"Sam Hulick" <Click here to reveal e-mail address> wrote in message
news:OqtnZumBCHA.2672@tkmsftngp05...
[Original message clipped]


> wr = (HttpWebRequest)WebRequest.Create(txtURL.Text);
!!!! this creates the second new wr object

[Original message clipped]

best regards Enriko

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
Sam Hulick
Thanks

Now the timeout works. But those sites still cause the app to lock up. Any
idea why??

"Enriko Riba" <Click here to reveal e-mail address> wrote in message
news:ORaf4duBCHA.1696@tkmsftngp04...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Tom Kaiser
So what do you mean it locks up?

does the wr.GetResponse() execute? Where is it locking up?

Are you doing this from inside a corporate firewall where you are going
through a proxy?

"Sam Hulick" <Click here to reveal e-mail address> wrote in message
news:eP1fRjuBCHA.1664@tkmsftngp02...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
    
Sam Hulick
wr.GetResponse() executes but it stays there until it reaches the timeout
value I specified. Then the timeout exception is thrown.

No, no fancy proxies or anything.. just a NAT firewall, nothing else
special. I can surf to these sites normally.

"Tom Kaiser" <Click here to reveal e-mail address> wrote in message
news:#iWXOR4BCHA.2464@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
New book project – Multimobile Development: Building Applications for any Smartphone
Dive into HTML5
 
    
Tom Kaiser
Can you provide a trace of a request to a page that locks up?

or send me the url of one of these pages.

Thanks
Tom

"Sam Hulick" <Click here to reveal e-mail address> wrote in message
news:O$pQ3oFCCHA.580@tkmsftngp02...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
michael
Hi,

By any chance is there a process running on your machine that is eating up
100% of the cpu? I just spent a week debugging a problem with .NET web
clients hanging. They would hang on GetResponse whenever there was a process
on the machine eating 100% of the cpu (seti, distributed.net, while(true){}
loop in a C++ command line program). As soon as I stopped that process, the
clients worked fine.I have no idea how this other process could be affecting
the .NET web service client.

Michael

"Tom Kaiser" <Click here to reveal e-mail address> wrote in message
news:eZ5ZqsQCCHA.1272@tkmsftngp04...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Steve Jobs’ thoughtful/thought provoking Thoughts on Flash…
Handy list of countries in CSV format
 
    
Sam Hulick
Wow.. you know what, I do run that Cancer Research app. It eats 100% CPU,
but only idle cycles. I'll try disabling that & seeing what happens.

Thanks for the tip!

"michael" <Click here to reveal e-mail address> wrote in message
news:#OMPfYxCCHA.2540@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
 
System.Net.HttpWebRequest
System.Net.WebRequest
System.Net.WebResponse




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734