Skip to main content

What i learned today.

Working with ASP.Net and SilverLight in my current project i learned two important things today
  1. SL will always show generic NotFound exception for a remote call failures irrespective of what was returned from server. This limitation roots in the browser which does not pass the exception details to the SL plugin. The only way around is to always send a responses which have Fault property for the SL client to work with.
  2. ASP.Net forms authentication mechanism always redirects on 404 error and behaviour is hard to change. This becomes a problem working with SL or ASP.Net MVC clients which expect Http error code (REST clients). The workaround that i found on Stackoverflow was to thrown 403 Error Code instead of 401. This way service calls made from SL or ASP.Net MVC can return http status codes (REST endpoints) and will not cause server redirects.

Comments

Popular posts from this blog

Caching Images downloaded from web on Windows Phone Isolated storage

I was helping on a Windows Phone application where the requirement was to cache the images the phone downloads on the isolated storage for offline viewing.
I wanted a solution which was simple and as transparent as possible. While researching I found  someone wrote a Silverlight converter for loading images from isolated storage. Taking that as a base I created a converted which can
Load image from web (http + https), and persist it to isolated storage.In case of network connectivity issues can load the same image from isolated storage. It does that by mapping the http url to a isolated storage location.In case the network is down and the image is neither there in cache, loads a default image, passed as parameter to converter.Here is the gist for the implementation.


To use the converter
Import the name space.Declare the converter as resource.Set the Image Source Property to use this converter like this 

AngularJS Model - ViewModel

Recently Robin Ward did a comparison between AngularJS and Ember (both the post and the comments are interesting read). One of the complaint that Robin had that AngularJS does not provide any specialized model class. As described in the blog

There is no standard Model base class, nor is there a component or interface in AngularJS that defines what a model is supposed to be.
What that means is that anything defined on $scope can acts as model, as this sample on the blog describes




For some (like me) this is the flexibility where as for others who want a more structural approach this is a nuisance.AngularJS does not even provide any definite guidelines around how the model should be actually designed to be effective with AngularJS

This leads to what we call as $scope pollution. We define multitude of properties on the $scope object and managing it becomes difficult.  Looking at the code one cannot tell what is the actual model and what properties are just to support UI logic.

Model Desig…