Length ='requestStream.Length'抛出类型'System.NotSupportedException'的异常

时间:2014-01-27 09:43:23

标签: c# asp.net zendesk

我已经消耗了Zendesk rest apis创建案例,下面是代码的和平

byte[] bytes = Encoding.UTF8.GetBytes(strXML);
DisputeResolutionEntity disputeResolutionEntity = new DisputeResolutionEntity();
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(ConfigurationManager.AppSettings["zendeskAdd"].ToString());
request.Method = "POST";
password = Clearshift.Registration.CommonFunction.DecryptString(password);
request.Credentials = new NetworkCredential(userName, password);
request.ContentType = "application/xml";
request.ContentLength = bytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

我发现“Stream”对象的“Length”和“Position”属性返回错误:

  

Length ='requestStream.Length'引发类型'System.NotSupportedException'的异常

有人可以帮忙吗?

0 个答案:

没有答案