开发者

HTTP requests failing on mobile networks, fine on WiFi

I have an WP7 application that I have been developing via the emulator. This app sends off a few web requests and waits for the responses. It works fine on the emulator but on the phone it only works on the wifi. Any ideas?

EDIT: On mobile networks the application just closes after the first reqest is made. I'm pretty sure that there is some sort of exception being thrown here as it is the only time the app would close without user input. To further aggravate the issue I live in an area where there is no mobile coverage so I cannot test w开发者_JAVA百科ith the debuger attached.

EDIT: ok tests done, it seems the first request I send comes back null. This only happens when on a cell network, it works fine on WIFI

here is the request:

RequestUrl = String.Format("https://www.o2online.ie/amserver/UI/Login?org=o2ext&IDToken1={0}&IDToken2={1}", UserName, Password)


I would check if WMAppManifest.xml does include the ID_CAP_NETWORKING capability:

<Capabilities>
  <Capability Name="ID_CAP_NETWORKING"/>
  ...
</Capabilities>


Ok got it working by allowing the request to wait for the full response:

            _httpRequester.AllowReadStreamBuffering = true;

The next question is now. Since I only need the first 100 or so characters of the request is there any way to set a buffer size? I am using the response HTML to verify I logged in correctly. This works snappy on WiFi but not so fast on GSM (3g is fine too put plan for the worst and all that).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜