I was teaching on the Silverlight Tour today and since the new release of Silverlight 2.0 is around the corner, I decided to do most my demos in Silverlight 1.1 instead of Silverlight 1.0. There were two problems that cropped up during the class. Luckily my students were patient while we dug deeper to find out why it was acting wonky. The two issues I found were:
Curious? In both cases it stemmed from the fact that the 1.1 templates in Visual Studio 2008 are both file based. When you launch the test.htm page, it lauches it in the browser using the address of the file as a FILE based address (e.g. “d:\workshop\testproject\test.htm”).
The problem is that the FILE protocol is treated very differently by Silverlight. When you download a video over a FILE Uri, the progress fires repeatedly but for some reason always reports 100% (I assume its because it already exists on disk). Downloading the .zip file seems to be related to a security limitation of downloading from the local machine.
To fix this, I simply created a quick and dirty ASP.NET web site project and did a Silverlight Link to my Silverlight project… Luckily, this worked fine. The difference here is that the ASP.NET project uses the built-in web server to serve up the page so we could really test these concepts over a web server which is closer to reality than the FILE protocol.
I hope that the new templates released for 2.0 don’t use this same technique.