本文介绍了此流不支持c#中的搜索操作异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我正在使用此代码。
Hello ,
I am using this code.
WebRequest webRequest = WebRequest.Create(strURL);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
string parameters = "xml=" + s;
byte[] bytes = Encoding.UTF8.GetBytes(parameters);
webRequest.ContentLength = bytes.Length;
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(bytes, 0, bytes.Length);
dataStream.Close();
WebResponse webResponse = webRequest.GetResponse();
dataStream = webResponse.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
responseFields = reader.ReadToEnd();
reader.Close();
dataStream.Close();
webResponse.Close();
这里字节长度是3050和
它显示了
流数据流= webRequest.GetRequestStream(); 此行中的此流不支持搜索操作的例外
谢谢&问候
Srishti
Here bytes length is 3050 and
It showing an exception that "this stream does not support seek operations" in
Stream dataStream = webRequest.GetRequestStream(); in this line
Thanks & Regards
Srishti
推荐答案
这篇关于此流不支持c#中的搜索操作异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!