Error while reading response from HttpWebRequest
===

I am trying to send contents of 1GB text file over the network. I modified the <a href="http://support.microsoft.com/kb/908573"> suggested code </a> for basic authentication and kept it as follows :

            WRequest = (HttpWebRequest)HttpWebRequest.Create(URL);

            WRequest.Credentials = Credentials;
            WRequest.PreAuthenticate = true;

            WRequest.ContentType = "text/plain"; 
            WRequest.Method = "POST";
            WRequest.AllowWriteStreamBuffering = false;
            WRequest.Timeout = 10000;

            FileStream ReadIn = new FileStream(filename, FileMode.Open, FileAccess.Read);
            ReadIn.Seek(0, SeekOrigin.Begin); 
            WRequest.ContentLength = ReadIn.Length; 
            Byte[] FileData = new Byte[ReadIn.Length]; 
            int DataRead = 0;
            Stream tempStream = WRequest.GetRequestStream();
            do
            {
                DataRead = ReadIn.Read(FileData, 0, 2048);
                if (DataRead > 0) 
                {
                    tempStream.Write(FileData, 0, DataRead);
                    Array.Clear(FileData, 0, 2048); 
                }
            } while (DataRead > 0);

           
            // The response
            WResponse = (HttpWebResponse)WRequest.GetResponse();

However, now it gives me System.Net.ProtocolViolationException error : "You must write ContentLength bytes to the request stream before calling [Begin]GetResponse". I checked <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx">HttpWebRequest.BeginGetRequestResponse </a>... and found from debugging that the contentlength for WRequest is not -1. What else could be going wrong ? How should I get the response ?
