private static HtmlDoc GetDocument(IHttpRequestFactory factory, IHttpWire wire, out int length) { var request = CreateRequest(factory, wire); var bytes = request.Download() as byte[]; if (bytes == null) { bytes = new byte[0]; } string html = string.Empty; length = bytes.Length; html = Encoding.UTF8.GetString(bytes, 0, bytes.Length); HtmlDoc doc = Config.DomFactory.Create(); doc.Load(html); return(doc); }