InvalidOperationException on getRequestStream in C#(Windows Mobile 6.5)
While trying to upload the video to server i am facing the Invalid Operation exception at getInputStream.Could you please let me know how i can resolve this issue in windows mobile 6.5.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.Method = "POST";
request.Proxy = null;
try
{
Stream requestStream = request.GetRequestStream();
using (Stream video = File.OpenRead("Path"))
{
byte[] buffer = new byte[4096];
while (true)
{
int bytesRead = video.Read开发者_运维知识库(buffer, 0, buffer.Length);
if (bytesRead == 0) break;
requestStream.Write(buffer, 0, bytesRead);
}
}
}
catch (InvalidOperationException ex)
{
MessageBox.Show(ex.Message);
}
I am not even getting the full message displayed.Could you please let me know the procedure to be followed to view the complete message and do i require it to install on my system or mobile device.
Please let me know your valuable suggestions.
Thanks in advance :)
When you are opening the File where is "Path" defined? Also, what thread is this being run on?
精彩评论