0

I'm having multiple applications hosted under one site in IIS. Each application have unique VirtualPath, so i have something like this:

  1. localhost/Site1
  2. localhost/Site2
  3. ...
  4. locahost/SiteN

What I'm trying to do - to build valid URL using out of the box helpers, like UriBuilder. Problem is that using default constructor like

var builder = new System.UriBuilder("https://mysite/Site1");

will split my address into

  1. Host: mysite
  2. Path: Site1

Is there any "right approach" or best practices for generating addresses for sites hosted like this?

  • Are you trying to access the virtual paths of the other sites in one site? – Balah Feb 02 '16 at 19:18
  • I'm trying to get right url, when I'm using builder.ToString(). Problems begin when I'm assigning Path to string builder - the "site1" part dissapears – Jevgenijs Saveljevs Feb 02 '16 at 19:36
  • Have you tried the `Uri` class? With it you can combine any base url and right url. e.g. `var uri1 = new Uri("https://mysite/site1", "mypath.html");` – Balah Feb 02 '16 at 20:48

0 Answers0