public virtual IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback callback, object state) { this.Context = context; HttpRequest req = context != null ? context.Request : null; string filePath = req != null ? req.FilePath : null; if (!String.IsNullOrEmpty(filePath) && String.Compare(".asp", VirtualPathUtility.GetExtension(filePath), StringComparison.OrdinalIgnoreCase) == 0) { throw new HttpException(String.Format("Access to file '{0}' is forbidden.", filePath)); } if (req != null && String.Compare("POST", req.HttpMethod, StringComparison.OrdinalIgnoreCase) == 0) { throw new HttpException(String.Format("Method '{0}' is not allowed when accessing file '{1}'", req.HttpMethod, filePath)); } var sfh = new StaticFileHandler(); sfh.ProcessRequest(context); return(new DefaultHandlerAsyncResult(callback, state)); }
public virtual IAsyncResult BeginProcessRequest (HttpContext context, AsyncCallback callback, object state) { this.Context = context; HttpRequest req = context != null ? context.Request : null; string filePath = req != null ? req.FilePath : null; if (!String.IsNullOrEmpty (filePath) && String.Compare (".asp", VirtualPathUtility.GetExtension (filePath), StringComparison.OrdinalIgnoreCase) == 0) throw new HttpException (String.Format ("Access to file '{0}' is forbidden.", filePath)); if (req != null && String.Compare ("POST", req.HttpMethod, StringComparison.OrdinalIgnoreCase) == 0) throw new HttpException (String.Format ("Method '{0}' is not allowed when accessing file '{1}'", req.HttpMethod, filePath)); var sfh = new StaticFileHandler (); sfh.ProcessRequest (context); return new DefaultHandlerAsyncResult (callback, state); }