funnypeck
Posts: 2
Score: 0
Joined: 11/3/2009
Status: offline
|
i'm new in mobile development, i already find many related post for many days, hope experts in forum can help me find the solution, thank you. the code is work fine in desktop application but when move to compact framework, some error found,one of the error show below: below is my code HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Method = "POST"; webRequest.Timeout = this.TimeOutMiliSecs; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.KeepAlive = false; Byte[] bytes = Encoding.GetEncoding("UTF-8").GetBytes(this.Param); Stream os = null; WebResponse webResponse = null; HttpWebResponse response = null; StreamReader sr = null; String errorMsg = "-999-" + System.Environment.NewLine; try { webRequest.ContentLength = bytes.Length; //i get the error 'System.Net.ProtocolViolationException' in this line os = webRequest.GetRequestStream(); os.Write(bytes, 0, bytes.Length); webResponse = webRequest.GetResponse(); sr = new StreamReader(webResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8")); this.Value = sr.ReadToEnd().Trim(); } hope can get the solution soon
< Message edited by funnypeck -- 11/3/2009 3:48:39 AM >
|