Stream exception - This stream does not support seek operations

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
  Hi, I got the "This stream does not support seek operations."  exception on the below mentioned line (bold and red line) when called the <b><font color="#cc0000 GetRequestStream()</font></b> method. Exception shown is "Length = oStreamOut.Length threw an exception of type System.NotSupportedException.  Whats wrong with this code? Could any one help me out?
private void __buildReqStream(ref WebRequest webRequest)
        {
            if (HttpContentToPost_in.Length > 0)
            {
                byte[] bytes = Encoding.ASCII.GetBytes(HttpContentToPost_in);
                webRequest.ContentLength = bytes.Length;
                <font color="#cc0000 Stream oStreamOut = webRequest.GetRequestStream(); <<<<< Error Line</font>
                oStreamOut.Write(bytes, 0, bytes.Length);
                oStreamOut.Close();
            }
        }
Thanks in advance :)

View the full article
 
Back
Top