title: Alternatives to using WebClient.BaseAddress to get base url in Silverlight
body: <p>In a Silverlight application I sometimes need to connect to the web site where the application is hosted. To avoid hard coding the web site in my Silverlight application I use code like this:</p>
  
  <pre><code>WebClient webClient = new WebClient();
  Uri baseUri = new Uri(webClient.BaseAddress);
  UriBuilder uriBuilder = new UriBuilder(baseUri.Scheme, baseUri.Host, baseUri.Port);
  // Continue building the URL ...
  </code></pre>
  
  <p>It feels very clunky to create a <code>WebClient</code> instance just to get access to the URL of the XAP file. Are there any alternatives?</p>