I was trying to host silverlight application in blogger from the past two weeks and at last succeded today :) as you can see below.
When i first googled, i found this wonderful post of timheuer which explains about cross-domain hositing of silverlight application in detail.
The big question which i had after reading tim's blog post is, where do i host my xap file as i need to set the XAP mime type on the hosting server, I personally do not own any hosting space nor any domain.
In the next moment i started searching for free file hosting providers, which can provide me a direct link for hosted file with file extension so that i can refer to the xap file directly. I tried around 5 different file hosting servers but i couldn't figure out how to set the mime extension type on that perticular server to render my silverlight xap on my blogger blog.
In my 6th attempt to host xap, i have tried with xtreemhost file hosting which has not only provided me with a direct link to the hosted file but also provided access to the .htaccess file where i could add my MIME types.
So here are few things which we need to take care before hosting a silverlight application on to blog:
- Make sure you have added the EnableHtmlAccess parameter to the object tag in html
<param name="enableHtmlAccess" value="true" />
- Make sure you have set ExternalCallersFromCrossDomain to ScriptableOnly in the AppManifest.xml file in silverlight project
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ExternalCallersFromCrossDomain="ScriptableOnly"> <Deployment.Parts> </Deployment.Parts> </Deployment>
- Add the MIME types on the hosting server(if not added already :)).
On XtreemHost this is how i added the MIME types, In the /htdocs directory i have created a new file with name .htaccess and added the below mentioned two lines in the .htaccess file
AddType application/x-silverlight-app .xap AddType application/xaml+xml .xaml
Here onwards everything should be straight-forward and simple, upload your xap file on to the file hosting server and set the source value in the object tag to the hosted xap file, below is the object tag for the above rendered silverlight application
Done.. That should do it!!!! If nothing went wrong then your silverlight application should be on you blog as mine :).
Hope this helps someone.. comments are always welcome and please let me know if you have any issues in loading silverlight applicaiton on your blog.