3
votes

I have Silverlight application called MyApp. During startup MyApp loads MyApp.Main.xap module using the following code:

WebClient wc = new WebClient();
wc.OpenReadCompleted += new OpenReadCompletedEventHandler(onMainModuleLoaded);
Uri uri = new Uri("MyApp.Main.xap", UriKind.Relative);
wc.OpenReadAsync(uri);

It works. Within MyApp.Main I would like to load another xap file MyApp.Billing.xap, so I wrote like the same as above

WebClient wc = new WebClient();
wc.OpenReadCompleted += new OpenReadCompletedEventHandler(onBillingModuleLoaded);
Uri uri = new Uri("MyApp.Billing.xap", UriKind.Relative);
wc.OpenReadAsync(uri);

but it throws an error saying the file not found. MyApp.Billing.xap file is inside ClientBin folder and I can download it directly via absolute path in a browser. If I try to download MyApp.Billing.xap not from inside MyApp.Main, but from inside MyApp (instead of MyAPp.Main.xap) it also works fine. What might be the problem?

1

1 Answers

0
votes

See if you have more success by using the various properties at Application.Current.Host.Source to put together a complete (absolute) uri, instead of trying to use a relative one (after all, what is it relative to?).