Protocol Violation Exception for httpWebrequest

hi all,

I am trying to send the set of datas to the server in the RequestStream.But i m getting error of protocolviolation exception.Code i m using is::

HttpWebRequest httpReq;
HttpWebResponse httpResp;
Stream httpStream;
string ServiceInfo = "Uploads/1.0 ";
try
{
ServiceInfo += DeviceInfo();
ASCIIEncoding ASCII = new ASCIIEncoding();
Uri l_uri = new Uri("http://or2.inamobile.co.uk/inamobile/xml");
httpReq = (HttpWebRequest)WebRequest.Create(l_uri);


httpReq.AllowWriteStreamBuffering = true;

httpReq.SendChunked = true;
httpReq.Method = "POST";
httpReq.Timeout = 60000;
httpReq.ContentType = "text/xml";
httpReq.ContentLength = 0;

FileHashCode = Codecs.CryptoSecure.XmlToCryptoMD5(xmlPath, ref FileLength);
using (Stream stream = httpReq.GetRequestStream())
{

StreamWriter Writer = new StreamWriter(stream);

Writer.NewLine = "\r\n";

Writer.Write("User-Agent" + ServiceInfo.ToString());

Writer.Write("X-Document-id " + FileHashCode.ToString());
Writer.Write(Writer.NewLine);
Writer.Write("X-Document-length " + FileLength.ToString());
Writer.Write(Writer.NewLine);
Writer.Write("X-InAMobile-msisdn "+"0");
Writer.Write(Writer.NewLine);
Writer.Write("Content-id " + FileHashCode.ToString());
Writer.Write(Writer.NewLine);
Writer.Close();
stream.Close();
}




Answer this question

Protocol Violation Exception for httpWebrequest

  • Ole Jepsen

    hi,

    plz any help in this matter it would gr8 to me.


  • Protocol Violation Exception for httpWebrequest