WPF applications deployment on the browser using XBAP

11. January 2013 01:44 by Mrojas in deployment, WPF, XBAP  //  Tags: , , , ,   //   Comments (0)

WPF is great and powerful technology to create compelling Windows Desktop applications when you need a rich user interface. 

Artinsoft/Mobilize.NET provide tools and services that allows you to modernize your VB6, Windows Forms and Powebuilder apps to WPF. Once your applications are on WPF you can also benefit from features like XBAP... 

From Wikipedia: 

"XAML Browser Applications (XBAP, pronounced "ex-bap") are Windows Presentation Foundation (.xbap) applications that are hosted and run inside a web browser such asFirefox or Internet Explorer. Hosted applications run in a partial trust sandbox environment and are not given full access to the computer's resources like opening a new network connection or saving a file to the computer disk and not all WPF functionality is available. The hosted environment is intended to protect the computer from malicious applications; however it can also run in full trust mode by the client changing the permission." 

XBAP is in general a simplification of the Click Once deployment, but specifically for WPF applications. 

Embedding Windows Forms Applications in a WebBrowser using XBAP

In this post I will add references to other pages which do a great work on explaining how to use this approach to host a Windows Forms App inside a WebBrowser. 

The technique described here is a deployment solution to ease distribution of applications modernized from legacy technologies to Windows Forms, maybe using the Artinsoft\Mobilize.NET tools ;) 

NOTE: "This workaround of .NET Winforms to WPF and then hosting it in a browser isn't truly moving a Windows based application to a web based application. e.g. database calls will be made from inside the browser on the users PC to the database, not via the IIS server. Therefore this functionality is most useful if you have connected your Winforms UI to you back-end code using web services, then you can have a somewhat web based application."  

Adam Berent gives step by step instrutions:

 

 

 

 

 

 

Figure 1: Example of Windows Forms applications running inside FireFox browser using an XBAP wrapper.

 

Some details that are missing in this article are related to how to publish the application on IIS, and these can described as: 

1. Create a test Certificate within Visual Studio and sign it against the project.  

The following links provides information on how to sing the xbap with your own certificate. 

2. Within VS publish the application. 

3. Setup the MIME encoding on the IIS server. See http://msdn.microsoft.com/en-us/library/ms752346.aspx 
 

4. Install the certificate on the Client PCs 

The certificate must be added in the trusted publisher and in the trusted root authority. If this is not done correctly you get the error 'Trust not granted'