Silverlight and WPF Browser Application

You can see there 2 templates in Visual Studio. One is Silverlight Application in the Silverlight category and the other one is WPF Browser Application in the Windows category.

We know both the Silverlight and the WPF use XAML to define their UI logic, and Silverlight is for web and browsers (not for sure, you can have Silverlight out of the browser applications).

So what is WPF Browser Application ? What is the difference between Silverlight and WPF Browser Application ?

WPF Browser Application needs .NET Framework 3.0 or above to run the application. It has full functionality from .NET Framework. If you develop XBAP, which means your whole web application is written in XAML and WPF.

Silverlight is a small subset of .NET Framework, but it does not need .NET Framework, it has its own small runtime engine. It is a browser add-in, and used for displaying rich contents on the web page. It can also interact with JavaScript. If you develop Silverlight, which means your web page can contains more rich contents, just like Applet or ActiveX control on the web page.

Since WPF Browser Application uses installed .NET Framework of the local machine, it can leverage the libraries that Silverlight does not. Though conceptually that is right WPF Browser Applications run inside a sandbox where it has limited privileges. So to read or write data to the local machine the Application has to be set in the Full Trust mode.

For example you can have access to the ADO.NET library in WPF Browser Application.



It throws a SecurityException, because by default WPF Browser Application is set to Partial Trust mode. Go to the Properties of your project and change the security settings to Full Trust and then your code will run.


But this is not preferable and a solution unless your client can allow the application to be Full Trusted. This is OK to do an intranet environment.