private void context_EndRequest(object sender, EventArgs e) { if (Config.Enabled && _validExtension && IsValidContentType()) { DateTime start = DateTime.Now; _decoratorStream.CopyStream.Position = 0; string html; using (var reader = new StreamReader(_decoratorStream.CopyStream)) { html = reader.ReadToEnd(); } var validator = new XhtmlValidator(html); Collection <ValidationRecord> _errors = validator.Validate(); // calculate the duration. TimeSpan duration = DateTime.Now - start; // hand the rendering over to the renderer... _renderer.Render(_application.Response, _errors, duration, html); } }