How to determine IsLocalUrl ?

How to determine IsLocalUrl ?

During a security check on one of our projects, the advice came to have only local URL's possible to the login webscreen.
The login webscreen has an input OriginalURL ... and redirects to any URL passed into it

We got the advice to do something like this:

public bool IsLocalUrl(string url) {
  return System.Web.WebPages.RequestExtensions.IsUrlLocalToHost(  RequestContext.HttpContext.Request, url);

Anybody got a solution in OutSystems for this ?
You can check the actual server name (GetMachineName and GetMachineInternalName in HtmlRenderer) in the request and compare it to the URL requested (GetURL in HTTPRequestHandler).