SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I deploy my silverlight .xap file to a document library.I'd like to add the silverlight using the object control,like below

param name="source" value="{SiteUrl}/SLDocLib/HelloWorldSilverlightApplication.xap"

but the SharePoint token {SiteUrl} doesn render as the current web url,I change the {SiteUrl} to ~site,it deos not render to the current site url as well, can anyone shine some light on this?

share|improve this question
up vote 3 down vote accepted

why dont you put just the relative link in it? Then it will work in all zones, assuming that you have multiple zones. Than the {siteUrl} token is not needed. Apart from that, I believe that that token doesnt work, only works server-side(for example in masterpages, before the masterpage is rendered). If you check your web.config. If you really want to work this way, you might use some javascript (jquery/javascript client object model)

In addition to that: when using the SharePointclient-side object model in your silverlight application, it probably will not work. You need to load the xap via the silverlight webpart to make use of the current context. Otherwhise you may need to change your code and explicitedly open your SiteCollection by inserting the full URL.

share|improve this answer
Relative URL does the trick , thanks. – Ybbest Jul 11 '11 at 4:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.