Help: SmartPhone not liking HTTP 302 redirects it seems

  • Thread starter Thread starter Andrew Davey
  • Start date Start date
A

Andrew Davey

Any ideas why a request to a URI that returns a HTTP/1.1 302 Object
moved header works on my PC, but fails on the SmartPhone (windows
mobile 2003)

System.Net.HttpWebRequest request = null;
System.Net.HttpWebResponse response = null;
System.IO.Stream stream = null;

try
{
request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.engadget.com/common/videos/pt/Engadget_Podcast22.mp3");
response = (System.Net.HttpWebResponse)request.GetResponse();
// WebException is thrown here ^^^
stream = response.GetResponseStream();
// ...
}
catch (System.Net.WebException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
finally
{
if(response!=null) response.Close();
}

The exception message is "The response did not contain an end of
entity mark"

Watching the packets with PlasticSniffer I see that the code (running
in the phone) never attempts to make contact with the new server
specified in the 302 Location header.

Requesting the URL in Pocket IE on the phone works fine – just not
when running the code above. Is this a bug in the .NETCF?

Any ideas appreciated.

- Andrew Davey [http://www.equin.co.uk/ipoddersp]
 
Try to set the AllowAutoRedirect property of the HttpWebRequest to set to
true.

HTH... Alex
 
Thanks, but I have already tried that too. Also, MSDN says that
AllowAutoRedirect defaults to true anyway.

Anyone else have any ideas?
 
My internet connection is not routed thru a proxy. Does mean the
ActiveSync pass-thru connection is acting as a proxy of sorts? I'm not
sure how to configure that to behave differently? Also, why would
Pocket IE on the phone work fine, but the .NET code fail? It makes no
sense... :`(

- Andrew
 
Back
Top