GetResult Method (.NET)

The GetResult method returns an instance of a RuleEngineResult class that results of the rules test.  The RuleEngineResult class provides access to auto-generated HTML that can be output to the browser to display a customized pass/fail style table of results to the end user. This class also provides programmatic access to the results, such as the number of tests that passed or failed, the URL that a user should be redirected to - if any test results in a redirect action, and even the ability to check whether a particular test passed or failed, and so forth.

 

Syntax:

RuleEngineResult engineResult = ruleEngine.GetResult(BrowserObj bhObj, ExtendedBrowserObj extBrowObj);

bhObj: The BrowserInfo instance for the current request

extBrowObj The ExtendedBrowserObj instance for the current request

 

Returns:

engineResult : A RuleEngineResult instance that provides programmatic access to the results of the RET test.

 

C# Example:

<%

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

ExtendedOptions options = engine.GetExtendedOptions();

ExtendedBrowserObj extendedBrowObj = BrowserObj.GetExtendedBrowser(options);

BrowserObj browObj = BrowserObj.GetBrowser();

RuleEngineResult result = engine.GetResult(browObj, extendedBrowObj);

if (result.Redirect != null)

   // The rules dictate that the user should be redirected, so let's redirect them now.

   // Note that this will only ever apply if you define redirects as an action to take based on a test result.

   Response.Redirect(result.Redirect);

else {

   string ResultsTableHtml = result.HtmlTable;

   Response.Write(RulesTableHtml);

}

%>

 

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:

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)