private void MakeChildRequest(HttpApplication app, DecoratedWorkerRequest subWorker) { // Process the subrequest. HttpContext savedContext = HttpContext.Current; try { subWorker.ProcessRequest(null); if (log.IsDebugEnabled) { log.Debug("Called ProcessRequest(). Calling subWorker.WaitForEndOfRequest()."); } subWorker.WaitForEndOfRequest(); if (log.IsDebugEnabled) { log.Debug("subWorker.WaitForEndOfRequest() returned."); } } finally { HttpContext.Current = savedContext; string rawUrl = app.Context.Request.RawUrl; log4net.ThreadContext.Properties["url"] = rawUrl; // Workaround for bug in mod_mono (at least rev 1.0.9) where the response status // is overwritten with 200 when app.CompleteRequest() is called. Status (and headers) // *should* be ignored because they were already sent when the subrequest was processed... app.Response.StatusCode = subWorker.StatusCode; app.Response.StatusDescription = subWorker.StatusDescription; // If there was an error, rethrow it so that ASP.NET uses any custom error pages. if (subWorker.Exception != null) { HttpException httpException = subWorker.Exception as HttpException; if (httpException != null) { throw new HttpException(httpException.GetHttpCode(), "Unhandled HttpException while processing NeatUpload child request", httpException); } UploadException uploadException = subWorker.Exception as UploadException; if (uploadException != null) { throw new HttpException(uploadException.HttpCode, "Unhandled UploadException while processing NeatUpload child request", uploadException); } throw new Exception("Unhandled Exception while processing NeatUpload child request", subWorker.Exception); } // Otherwise call CompleteRequest() to prevent further processing of the original request. app.CompleteRequest(); } }
public void CopyFrom(object source) { UploadState src = (UploadState)source; this._BytesPerSec = src._BytesPerSec; this._BytesRead = src._BytesRead; this._BytesTotal = src._BytesTotal; this._Failure = src._Failure; this._FileBytesRead = src._FileBytesRead; this._Files = src._Files; this._MultiRequestObject = src._MultiRequestObject; this._PostBackID = src._PostBackID; this._ProcessingStateDict = src._ProcessingStateDict; this._Rejection = src._Rejection; this._Status = src._Status; this.BytesReadAtLastMark = src.BytesReadAtLastMark; this.IsMerging = src.IsMerging; this.TimeOfFirstByte = src.TimeOfFirstByte; this.TimeOfLastMark = src.TimeOfLastMark; this.TimeOfLastMerge = src.TimeOfLastMerge; this.UploadStateAtLastMerge = src.UploadStateAtLastMerge; }