我正在开发一个需要接收HTTP Post请求并将其读入字节数组以进行进一步处理的网页。我有点卡在如何做这个事情上,不知道最好的方法是什么。这是我目前的代码:
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[]字段中。
谢谢!