Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Get The URL For the Page Serving Your Silverlight App

0.00/5 (No votes)
21 May 2010 1  
Dorothy was right - there's no place like home.
I needed to use a different connection string for database access, depending on what host was serving my Silverlight application. Here's how to do it:

For VB:
Imports System.Windows.Browser
Dim url As String = HtmlPage.Document.DocumentUri.ToString()


For C#:
using System.Windows.Browser;
string url = HtmlPage.Document.DocumentUri.ToString();




License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here