So, had this issue where HTTPWebRequest was throwing a WebException on a production HTC HD7 device – the error was "The remote server returned an error: NotFound."  However, the browser itself worked fine. What was really weird was that these same HTTPWebRequest calls work fine in the emulator and Samsung devices. I was totally flummoxed.

Turns out that there were a few misleading things to solve this bug.

First, was that all Web Request errors are mapped to a 404. So the real error could be (and was) different. In fact, the error from the server was a 500. The reason? The call to the server was the start of an OAuth handshake which involved sending a timestamp. Apparently, HTC phones with no SIM card don’t set the date or time correctly, and thus the DateTime.UtcNow was returning something totally bogus, and the server was rejecting the call.

The fix was to add a dialog to the app in the event that the time hasn’t been properly set.

One suggestion for debugging these types of HTTP failures is by setting the WiFi proxy on the phone to your machine’s IP, then using Fiddler2, and enabling the “Remote connections” option under Fiddler’s options.