title: Selenium: Find the base Url
body: <p>I'm using Selenium on different machines to automate testing of a MVC Web application.</p>
  
  <p>My problem is that I can't get the base url for each machine.</p>
  
  <p>I can get the current url using the following code:</p>
  
  <pre><code>IWebDriver driver = new FirefoxDriver();
  string currentUrl = driver.Url;
  </code></pre>
  
  <p>But this doesn't help when I need to navigate to a different page.</p>
  
  <p>Ideally I could just use the following to navigate to different pages:</p>
  
  <pre><code>driver.Navigate().GoToUrl(baseUrl+ "/Feedback");
  driver.Navigate().GoToUrl(baseUrl+ "/Home");
  </code></pre>
  
  <p>A possible workaround I was using is:</p>
  
  <pre><code>string baseUrl = currentUrl.Remove(22); //remove everything from the current url but the base url
  driver.Navigate().GoToUrl(baseUrl+ "/Feedback");
  </code></pre>
  
  <p>Is there a better way I could do this??</p>