public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            if (_result != null)
                throw new InvalidOperationException("An asynchronous operation is already pending.");

            HttpRequest request = context.Request;
            NameValueCollection query = request.QueryString;

            //
            // Limit the download by some maximum # of records?
            //

            _maxDownloadCount = Math.Max(0, Convert.ToInt32(query["limit"], CultureInfo.InvariantCulture));

            //
            // Determine the desired output format.
            //

            string format = Mask.EmptyString(query["format"], "csv").ToLower(CultureInfo.InvariantCulture);

            switch (format)
            {
                case "csv": _format = new CsvFormat(context); break;
                case "jsonp": _format = new JsonPaddingFormat(context); break;
                case "html-jsonp": _format = new JsonPaddingFormat(context, /* wrapped */ true); break;
                default:
                    throw new Exception("Request log format is not supported.");
            }

            Debug.Assert(_format != null);

            //
            // Emit format header, initialize and then fetch results.
            //

            context.Response.BufferOutput = false;
            _format.Header();

            AsyncResult result = _result = new AsyncResult(extraData);
            _log = ErrorLog.GetDefault(context);
            _pageIndex = 0;
            _lastBeatTime = DateTime.Now;
            _context = context;
            _callback = cb;
            _errorEntryList = new ArrayList(_pageSize);

            _log.BeginGetErrors(_pageIndex, _pageSize, _errorEntryList,
                new AsyncCallback(GetErrorsCallback), null);

            return result;
        }