471,306 Members | 1,249 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

HTTP Post Problem in Pocket PC

I posted this question in PocketPC newsgroup with no answer. Hopefully
somebody in this newsgroup can help me.

I have problem with HTTP post in Compact Framework. The code below is
a function I use to post a HTTP message. This code works in Windows XP
always. When I compile the same code to run on an iPaq PocketPC 2003
it works exactly 2 times and then fails afterward at line
"GetResponseStream()" with the exception;
"System.Net.WebException; Could not find resource assembly"
I have tried this code through the ActiveSync USB link and also a
SocketComm compact flash network card on the iPaq with exactly the same
failure after two times working properly. If I quit the application
and run it again it works again for two times and then fails afterward.

I can't figure out why this code works on Windows XP and fails after
exactly two times in an iPaq under Compact Framework. Is there a
resource that is not released in PocketPC? Can failure after 2 times
give a clue what might be wrong? Is there a way to modify the code to
work always? Is there a sample code for proper HTTP Post in PocketPC?
Any help is highly appreciated.
// -----------------------------------------------------
// -----------------------------------------------------
// -- HTTP Post function. Failing line shown ----------
// -----------------------------------------------------
public string HttpPost(string URI, string PostMessage)
System.Net.WebResponse resp = null;
System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
req.ContentType = "text/xml";
req.Method = "POST";
req.Timeout = 2000; // 2 seconds
byte[] bytes =
req.ContentLength = bytes.Length;
System.IO.Stream os = req.GetRequestStream(); // <-- fails here
after 2 times
os.Write(bytes, 0, bytes.Length);
resp = req.GetResponse();
catch (Exception e)
string msg = "HTTP Post failed\r\n";
msg += e.ToString();
return msg;
if (resp == null) return null;
System.IO.StreamReader sr = new
return sr.ReadToEnd().Trim();

Dec 13 '05 #1
0 2116

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Krishnan Margabandhu | last post: by
5 posts views Thread by Terry Metcalfe | last post: by
reply views Thread by rosydwin | 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.