我正在开发一个需要采用HTTP Post Request并将其读取到字节数组中进行进一步处理的Web页面。我一直在坚持如何做到这一点,而且我很难完成什么是最好的方法。这是我到目前为止的代码:将Http请求读入字节数组
public override void ProcessRequest(HttpContext curContext)
{
if (curContext != null)
{
int totalBytes = curContext.Request.TotalBytes;
string encoding = curContext.Request.ContentEncoding.ToString();
int reqLength = curContext.Request.ContentLength;
long inputLength = curContext.Request.InputStream.Length;
Stream str = curContext.Request.InputStream;
}
}
我检查的要求和等于128现在做我只需要使用一个Stream对象进入它的byte []格式的总字节的长度?我正朝着正确的方向走吗?不知道如何继续。任何建议都会很棒。我需要将整个HTTP请求放到byte []字段中。
谢谢!
我没有.CopyTo? – Encryption 2012-03-30 18:37:15
如何在不使用.CopyTo选项的情况下使用内存流? – Encryption 2012-03-30 18:39:53
@加密:你可以自己实现一些非常相似的东西 - 我将在一分钟内编辑它... – 2012-03-30 18:40:24