The solution attached with the post is a very easiest way to host a Silverlight Application in any Sharepoint site. Ready-to-use component is just 9 KB. You can opt to download it and check the usage.

Download link: http://software.ganshani.com/silverlighthost.htm [size: 10KB]

How-to use:

Usage is pretty simple and can be broken down in 2 steps:-

Download the latest patch

Open IIS to register the MIME for .xap extension

  • Go to Properties of your computer
  • Click on MIME Types
  • Add New:
  • Extension: .xap
  • MIME type: application/x-silverlight-app
  • Click OK thrice
  • Reset the IIS

Open the MOSS application – for settings

  • Click on Site Actions > Site Settings
  • Click on Webparts under the heading Galleries
  • Click New
  • Select SilverlightHostWebPart.SilverlightHost. Verify the signature: SilverlightHostWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5
  • Click on PopulateGallery button

Hosting Silverlight in Webpart

  • Open the ASPX page where Silverlight component needs to be hosted.
  • Add a new web part : SilverlightHost
  • Select Modify Shared Web Part
  • Set the properties:
    • Width: appropriate size of Silverlight control.
    • Height: appropriate size of Silverlight control.
    • XAP Source Location: this location should be in the virtual directory of MOSS application.Say for example, C:InetpubwwwrootwssVirtualDirectories8000 is the virtual directory. Then create a folder ClientBinSilverlightAppName and copy the XAP and other relevant files.So the source location is: /ClientBin/StockTicker/StockTicker.xap
    • Silverlight Control ID: a unique identifier.
    • Click on OK, to view the Silverlight content.

Configuring for Cross-Domain calls

If the Silverlight Application accesses some WebServices (ASMX, WCF) which are hosted on some other domain, make sure you have the crossdomain.xml and clientaccesspolicy.xml in the root folder of your virtual directory (C:InetpubwwwrootwssVirtualDirectories8000)

check for crossdomain.xml and clientaccesspolicy.xml in the download link.

I am sure this will ease out your work and will provide you a faster way to have RIA on Sharepoint 2007.

Download link: http://software.ganshani.com/silverlighthost.htm [size: 10KB]