Xbaps using Cookies

Earlier on I had written an app, BlogPadm which was fulltrust and the writer used Google Data API to write the content to Blogger.com. However, when you create an xbap version of it, a problem arises in that you cannot make WebRequests outside site of origin and hence, the xbap version of the above failed to take off. The workaround is to create a webservice at the site of origin so that the calls are forwarded.

However, the focus of this app was to test cookies. So I hosted a blog server and had the blogwriter at the site of origin. So the flow is something like this:

https://MainSite/Login.aspx à https://blogsite/blogwriter.xbap à https://blogsite/postentry.aspx

The communication between the asp pages and the xbap is through cookies.

Code for this application is attached. Note that this project makes use of servers and hence, the app won’t run on execution since the server code is now on the local machine.

The Blog engine used is the BlogEngine.net which is an open source blog server.

The sample is simplistic but is done so to show how communication through asp/xbaps can be performed using cookies. This was not possible in 3.0

· The main asp page sets a cookie ‘Authenticated’ with a value of 1 or 2.

· The value is analyzed by the xbap and decided the number of features to make available to the user.

· The xbap then sets 2 cookies for the TITLE and DATA of the blog and redirects to the blogserver page

· The blog server page then analyzes the data and posts the data on the server

The code for the Mainsite and blogwriter.xbap is provided. Only the postentry.aspx page of the blog engine was modified and hence only this code has been included. The blogwriter project also includes the projects for the Xaml-Html converter and the editor user control

 The code is attached.

Share this post

Blogpad Xbap.zip