title: How do I find the root site URL in a Share Point 2010 project?
body: <p>Is there a way to get the root url of the current server the Share Point application is hosted on? For example, if I want to load information from a site I'm currently typing:</p>
  
  <pre><code>SPSite site = new SPSite(http://dev3);
  </code></pre>
  
  <p>But when I move the development code onto the production server I have to manually replace the site URLs with the new server URLs:</p>
  
  <pre><code>SPSite site = new SPSite(http://sp2010);
  </code></pre>
  
  <p>I'm using C# in Visual Studio 2010.</p>