Silverlight 5 Ships – SharePoint and Silverlight Code Updated

As you may have noticed, Microsoft released Silverlight 5 to the web recently and it's available for download here.

I just updated the Silverlight 5 examples in for the book with the released version, and overall it went smoothly, however there are some changes for one of the examples, which I'll explain in this posting. The new download is available here for your development pleasure.

For most of the examples, all I had to do was uninstall the Release Candidate and install the released version, and it just worked. However the Chapter 11a example, which requires running in the browser with elevated trust, changed a little. This example demonstrates how to use the WebBrowser control in a solution; in this case it shows a preview of an article from an RSS feed. This requires the elevated trust, and the process for that has changed a little.

To allow trust in the Release Candidate, you needed to specify an out-of-browser application. The released version includes a special checkbox for in-browser trust, labelled "Require elevated trust when running in-browser," as shown below. There may have been other changes under the covers, as I found that checking the box on the RC version wasn't enough and left me with a corrupted project file. Therefore I made a new project file, which is now in the code download.

To run with elevated trust, your assembly also needs to be signed with a digital certificate, and the certificate needs to be trusted by your client. If you're doing this in a production envrionment, you'll ideally want to choose a certificate that your client already trusts, such as one from your Active Directory environment. In this case, however, I just used a test certificate. Fortunately, Visual Studio 2010 makes that really easy!

The figure below shows the Signing tab in the Silverlight project. The first step is to check the "Sign the Xap File" checkbox. Next, you need to select or create a digitial certificate which includes a public key. I simply clicked, "Create Test Certificate" to generate a test cert for development.

You'll need to install the certificate on your client as well. To do this, view the certificate by pressing the "More Details" button and then click on "Install Certificate". Manually install the certificate into the Trusted Root Certification Authorities and Trusted Publishers certificate stores.
Finally, you need to edit the registry on the client to enable trusted applications to run in browser. This is described on MSDN here. Basically, you need to use the registry editor to add a DWORD value called AllowElevatedTrustAppsInBrowser, and set its value to 1. On a 32-bit client, create the DWORD under HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight, and on a 64-bit client, place it in HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Silverlight.
Once you've completed that, your solution should begin to work!
Thanks and enjoy the Silverlight 5 experience!
Comments (0)

Skip to main content