How to get hostname part of a page URL?

Let’s imagine a page with /some/page as path and an absolute URL of https://www.example.com/some/page.

How do I isolate and get the hostname part including scheme https://www.example.com dynamically?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/111881-how-to-get-hostname-part-of-a-page-url