/// <summary> /// Initiates an asynchronous call to the HTTP handler. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param> /// <param name="cb">The <see cref="T:System.AsyncCallback"/> to call when the asynchronous method call is complete. If <paramref name="cb"/> is null, the delegate is not called.</param> /// <param name="extraData">Any extra data needed to process the request.</param> /// <returns> /// An <see cref="T:System.IAsyncResult"/> that contains information about the status of the process. /// </returns> public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { string path = context.Request.PhysicalPath; if (!File.Exists(path)) { throw new HttpException(404, "The requested file cannot be found."); } SvgAsyncRenderState reqState = new SvgAsyncRenderState(context, cb, extraData); SvgAsyncRender asyncRender = new SvgAsyncRender(reqState); ThreadStart ts = new ThreadStart(asyncRender.RenderSvg); t = new Thread(ts); t.Start(); return reqState; }
/// <summary> /// Initiates an asynchronous call to the HTTP handler. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpContext"/> object that provides references to intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param> /// <param name="cb">The <see cref="T:System.AsyncCallback"/> to call when the asynchronous method call is complete. If <paramref name="cb"/> is null, the delegate is not called.</param> /// <param name="extraData">Any extra data needed to process the request.</param> /// <returns> /// An <see cref="T:System.IAsyncResult"/> that contains information about the status of the process. /// </returns> public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { string path = context.Request.PhysicalPath; if (!File.Exists(path)) { throw new HttpException(404, "The requested file cannot be found."); } SvgAsyncRenderState reqState = new SvgAsyncRenderState(context, cb, extraData); SvgAsyncRender asyncRender = new SvgAsyncRender(reqState); ThreadStart ts = new ThreadStart(asyncRender.RenderSvg); t = new Thread(ts); t.Start(); return(reqState); }