GetHtmlResults Method (.NET)

The GetHtmlResults method returns a string containing an HTML table with all the test results, ready for output to the browser.  The table contains the pass/fail results and custom messages which you have defined in the XML. If you defined a rule to redirect the user to a given page and that rule is triggered, than the HTML resulted by this method will be a meta refresh tag that redirects the browser, rather than a HTML table of the results.

 

Syntax:

string html = ruleEngine.GetHtmlResults(BrowserObj bhObj, ExtendedBrowserObj extBrowObj);

bhObj: The BrowserInfo instance for the current request

extBrowObj The ExtendedBrowserObj instance for the current request

 

Returns:

html: An HTML string holding the result of the rule execution, as a table or redirect, which you should then output to the browser.

 

C# Example:

<%

RuleEngine engine = RuleEngine.GetFromFile("rules.xml"));

ExtendedOptions options = engine.GetExtendedOptions();

ExtendedBrowserObj extendedBrowObj = BrowserObj.GetExtendedBrowser(options);

BrowserObj browObj = BrowserObj.GetBrowser();

string htmlResults = engine.GetHtmlResults(browObj, extendedBrowObj);

Response.Write(htmlResults);

%>

 

Note: It is generally advisable to use the GetResult method in conjunction with the RuleEngineResult HtmlTable property, instead of using this GetHtmlResults method.  GetHtmlTable should really only be used if you are logging to your database the results of every rules check, and if you are using rules that can result in a redirect. This is because in that case, you will need to have the page displayed in order to capture the results for logging.

 

The downside of using GetHtmlResults is that if a rule results in a redirect, the user will see the page load just before being redirected (which is required for the logging) unless you add logic to your page to prevent the page from displaying under this condition.  Whereas with GetResult and the HtmlProperty on the RuleEngineResult class, you can control the execution must easier and redirect immediately; however results for rules that result in redirection cannot be logged to the database.

 

Tip: See the numerous RET samples included with BrowserHawk and the Rules Enforcement Technology Users Guide (available separately) for more information.

 

Note: This method requires the Enterprise Edition of BrowserHawk.

 

See Also:

GetResult Method (.NET)

RuleEngineResult HtmlProperty (.NET)

GetDataSet Method (.NET)

RuleEngine GetExtendedOptions Method (.NET)

GetFromFile Method (.NET)

GetFromString Method (.NET)

GetLogOptions Method (.NET)

About the RuleEngineResult Class

About the RuleEngine Class

About Rule Enforcement Technology (RET)