views:

118

answers:

1

So I've embedded my silverlight XAP like this

[assembly: WebResource("GravityWeb.PlayerControl.Silverlight.SilverlightPlayer.xap", "application/x-silverlight-2")]

and I can get the embedded url like this

this.Page.ClientScript.GetWebResourceUrl(this.Page.GetType(), "GravityWeb.PlayerControl.Silverlight.SilverlightPlayer.xap");

but the url it returns is something like this

/TestDev/WebResource.axd?d=d6ixqp92Ol-BJCkTEWYp3gTcwFUNVE60E5GKULjS0IDBLAsHkrM6GWi4TeG_jIwJxboE_2SvpNudG2WGsUzRxju97Q9LnPl4P9tQn5ga4ro1&t=633920190636398750

and my page is in the /TestDev virtual directory. As a result it doesn't load.

If it always does this how can I modify it to return root url of my website + web resource url. and do I need to url encode it? Do I have to put the root url of my site in a config somewhere or does ASP.NET have a method to get it?

+1  A: 

GetWebResourceUrl will always return the application root. You say your site is in a virtual directory called TestDev, so that is the application root. The reason the resource is not actually loading is something else.

Have you verified the xap asset is set to "Embedded Resource" in the project definition?

Rex M