FUNCTION OnUrlRewrite(loRewrite, lvParm1)
LOCAL llRouteError
*** This makes the rewrite object available to process methods
*** so you can read path segments from the collection
this.oRewrite = loRewrite
*** Assume second segment is our method name
IF loRewrite.oPathSegments.Count > 0
lcMethod = loRewrite.oPathSegments.Item(1)
llRouteError = .F.
lvResult = .F.
TRY
lvResult = EVALUATE("THIS." + lcMethod + "()")
CATCH
llRouteError = .T.
this.ErrorMsg("Invalid Route",;
"Couldn't find a matching route for this URL.")
ENDTRY
IF llRouteError
RETURN && ErrorMsg display
ENDIF
RETURN lvResult && result in case for Authentication etc.
ENDIF
this.ErrorMsg("Invalid Route",;
"Route values must at least include 1 segments relative to the virtual or root application")
ENDFUNC