Deploying Silverlight - revisited

June 18th, 2009

An error of the type:

Parser Error Message: Could not load file or assembly ‘System.Web.Silverlight’ or one of its dependencies. The system cannot find the file specified.

<%@ Register Assembly=”System.Web.Silverlight” Namespace=”System.Web.UI.SilverlightControls” TagPrefix=”asp” %>

Caused by embedding your application on an .aspx page, can be solved in Visual Studio by simply going to the project containing your page, and for the System.Web.Silverlight reference, change “Copy Local = True”. After doing this don’t forget to copy the .dll file together with your .aspx page.

alex~

How to deploy Silverlight application to a Server

June 18th, 2009

In two words: 1) copy your *.xap files; 2) make sure .xap and .xaml MIME types are registered.

Here is more information about registering mime types for Silverlight application.

Warning, if you are deploying your Silverlight application to a Virtual Folder of the existing website, then most likely you need to copy your ClientBin folder to the root of the website, not virtual folder.

-=Oleg=-

Silverlight Password Textbox

June 17th, 2009

Silverlight Textbox is not the same as ASP.NET.  There is no TextMode property that can be set to “password”.

Silverlight has a special control for Password fields. It’s called PasswordBox

Here is the sample of XAML with PasswordBox:

<PasswordBox Password="HelloWorld" x:Name="pbPassword">

 Another surprise from Silverlight development team is that PasswordBox control doesn’t have Text property. In order to retrieve the value of the Password field use the Password property instead:

string sPassword  = tbPassword.Password;

Recently I had to work on a prototype where TextBox control was originally used for collecting password information. So, I went and replaced TextBox control with Password control and then changing Text property to Password. Guess what, my code compiled fine but when I tried to run it, it crashed. The reason was in Style property.

<PasswordBox Password="HelloWorld" x:Name="pbPassword"
Style="{StaticResource myTextBoxStyle}" >

This style was defined for the TextBox. This style is not compatible with PasswordBox control. I didn’t have a chance to look at what exactly in myTextBoxStyle style is causing problems. I will find it out and update this post.

One more note about PasswordBox is that it has PasswordChar property which can be used to specify the masking character. It’s a nice useless feature with no real value. It would be much nicer if PasswordBox was inherited from TextBox so developers won’t spend their valuable time building special cases around this control.

Oleg.

Silverlight 3 Beta - My first bug

June 17th, 2009

At first, our encounter with the Silverlight 3 Beta was a good experience. Nice backward compatibility with code compiled in Silverlight 2, and without a re-compile it supported some new Video formats out of the box (that Silverlight 2 didn’t support).

Unfortunately, a day or two after, something really broke down, and now my Internet Explorer will not run Silverlight and Flash in the same window without crashing my app. Currently we have this issue on the Silverlight.net site:

http://silverlight.net/forums/t/101974.aspx

Hopefully someone will take a look at it.

alex~

About us

June 17th, 2009

Out of space we came with … a smile.

alex_75 and oleg_75