/// <summary> /// Processes the html codes /// </summary> public override string Execute() { Encoding _encoding; string resultHtml = StringStream.GetString( WebData.ResponseData, WebData.ResponseInfo.ContentType, _UserOptions.ForceEncoding, true, out _encoding); ContentEncoding = _encoding; if (_UserOptions.Frames) { IsFrameSet = HtmlTags.IsFramesetHtml(ref resultHtml); } if (_UserOptions.PageTitle) { PageTitle = HtmlParser.GetTagContent(ref resultHtml, "title"); } if (_UserOptions.DocType) { DocType = HtmlTags.GetDocType(ref resultHtml); } // Page url. E.G. http://Site.com/users/profile.aspx?uid=90 string pageUrl = WebData.ResponseInfo.ResponseUrl; // this is page path, used in processing relative paths in source html // for example the pageRootUrl for "http://Site.com/users/profile.aspx" will be "http://Site.com/users/" // gets page root Url string pagePath = UrlProvider.GetPagePath(pageUrl); // the page Url without any query parameter, used in processing relative query parameters // the pageUrlNoQuery for "http://Site.com/profile.aspx?uid=90" will be "http://Site.com/profile.aspx" // Gets page Url without any query parameter string pageUrlNoQuery = UrlProvider.GetPageAbsolutePath(pageUrl); // Execute the result Execute(ref resultHtml, pageUrl, pageUrlNoQuery, pagePath, WebData.ResponseInfo.ResponseRootUrl); // the result return(resultHtml); }
/// <summary> /// Apply redirect location to request location /// </summary> protected virtual string ReplaceResponseRedirectionLocation(Uri responseUri, string siteRootUrl, string redirectLocation) { string pageUrl = responseUri.ToString(); string pagePath = UrlProvider.GetPagePath(pageUrl); string pageUrlNoQuery = UrlProvider.GetPageAbsolutePath(pageUrl); if (redirectLocation[0] != '/' && redirectLocation[0] != '\\') { return(UrlBuilder.CombinePaths(pagePath, redirectLocation)); } else { return(UrlBuilder.CombinePaths(siteRootUrl, redirectLocation)); } }
public override string Execute() { Encoding _encoding; string resultCodes = StringStream.GetString( WebData.ResponseData, WebData.ResponseInfo.ContentType, _UserOptions.ForceEncoding, false, out _encoding); ContentEncoding = _encoding; if (_UserOptions.Images) { // Page url. E.G. http://Site.com/users/profile.aspx?uid=90 string pageUrl = WebData.ResponseInfo.ResponseUrl; // this is page path, used in processing relative paths in source html // for example the pageRootUrl for "http://Site.com/users/profile.aspx" will be "http://Site.com/users/" // gets page root Url string pagePath = UrlProvider.GetPagePath(pageUrl); // the page Url without any query parameter, used in processing relative query parameters // the pageUrlNoQuery for "http://Site.com/profile.aspx?uid=90" will be "http://Site.com/profile.aspx" // Gets page Url without any query parameter string pageUrlNoQuery = UrlProvider.GetPageAbsolutePath(pageUrl); // Execute the result Execute(ref resultCodes, pageUrl, pageUrlNoQuery, pagePath, WebData.ResponseInfo.ResponseRootUrl); } // the result return(resultCodes); }