In asp.net, there are different way to combine urls with the easiest way to simply add multiple strings and the better way to use classes and methods already from asp.net. In this post, I will show different way to add multiple url parts to form a valid url.
In asp.net there are few classes with urls can be constructed like the Uri class. However, I actually prefer the use of UriBuilder class as it provides more options to specify the parameters like host, query string, anchor links, port number and so on. This is much easier class to work with than to build urls with other classes. So, below is the source code for two ways to build urls - one with concatenating strings and another with UriBuilder class.