How to build URIs with the UriBuilder class in C#

You can normally use the URI object to construct URIs in C#. However, there’s an object called UriBuilder which lets you build up a URI from various elements.

Here’s an example to construct a simple HTTP address with a scheme, a host and a path:

UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = "http";
uriBuilder.Host = "cnn.com";
uriBuilder.Path = "americas";
Uri uri = uriBuilder.Uri;

uri will be “http://cnn.com/americas”.

Read more of this post

Advertisement

How to build URIs with the UriBuilder class in C#

You can normally use the URI object to construct URIs in C#. However, there’s an object called UriBuilder which lets you build up a URI from various elements.

Here’s an example to construct a simple HTTP address with a scheme, a host and a path:

UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = "http";
uriBuilder.Host = "cnn.com";
uriBuilder.Path = "americas";
Uri uri = uriBuilder.Uri;

uri will be “http://cnn.com/americas”

Read more of this post

Elliot Balynn's Blog

A directory of wonderful thoughts

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT TUTORIALS WITH OPEN-SOURCE PROJECTS

Once Upon a Camayoc

Bite-size insight on Cyber Security for the not too technical.

%d bloggers like this: