<p>Is there a simple way in .NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL:</p>

<p><code>http://www.mywebsite.com:80/pages/page1.aspx</code></p>

<p>I need to return:</p>

<p><code>http://www.mywebsite.com:80</code></p>

<p>I know I can use <code>Request.Url.AbsoluteUri</code> to get the complete URL, and I know I can use <code>Request.Url.Authority</code> to get the host and port, but I'm not sure of the best way to get the protocol without parsing out the URL string.</p>

<p>Any suggestions?</p>

Request.Url will return you the
Uri
of the request.  Once you have that, you can retrieve pretty much anything you want.  To get the protocol, call the
Scheme
property.
Sample:
```
```
Uri url = Request.Url;
string protocol = url.Scheme;
```
```
Hope this helps.