1 небольшое изменение: n-1 вместо n.
select *
from thetable
limit n-1, 1
Я решил проблему: я думаю, что вызов dispose в StreamReader должен убивать и InputStream.
Вместо использования StreamReader я сделал следующее:
var bytes = new byte[request.InputStream.Length];
request.InputStream.Read(bytes, 0, bytes.Length);
request.InputStream.Position = 0;
string content = Encoding.ASCII.GetString(bytes);
Итак полный код:
public class LoggingModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += ContextBeginRequest;
}
private void ContextBeginRequest(object sender, EventArgs e)
{
var request = ((HttpApplication)sender).Request;
var bytes = new byte[request.InputStream.Length];
request.InputStream.Read(bytes, 0, bytes.Length);
request.InputStream.Position = 0;
string content = Encoding.ASCII.GetString(bytes);
LogRequest(content)
}
}
Этот ответ не работал. Возвращает массив, который содержит нулевые значения.
var bytes = new byte[request.InputStream.Length]; request.InputStream.Read(bytes, 0, bytes.Length); request.InputStream.Position = 0; string content = Encoding.ASCII.GetString(bytes);
Необходимо использовать фильтр запросов . Напишите класс, производный от Stream , и зарегистрируйте его как фильтр.