TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
funnypeck woo
NA
5
0
get error in line 'webRequest.GetRequestStream()'
Nov 8 2009 8:22 PM
i'm new in mobile development, i already find many related post for many days. i using Microsoft Visual Studio 2008, language is C#, 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 the following screenshot can make you more understand what problem i facing:
when run in desktop application, the item inside webRequest without (!) infront, but when move to mobile application, many item have (!) infront, i tried to set webRequest.accept= null, but not work.
Please help.....
Reply
Answers (
2
)
CAn U suggest best way to store(database or as afile in in server ..?) and show flash and other videos in c#.net web site
Determining whether remote debugger is running