WCF Sessions with Silverlight and Flex

I wanted to adapt my Silverlight CRUD sample (which I also ported to Adobe Flex) to fix a glaring weakness, which is that any user can amend any entry.

I decided to add some logic that allows editing or deleting of only those rows created during the current session. The idea is that a user can amend the entry just made, but not touch any of the others.

WCF has its own session management but this is not supported by the BasicHttpBinding which is required by Silverlight.

Fortunately you can use ASP.NET sessions instead. This means setting your WCF web service for ASP.NET compatibility:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

Then you can write code using the HttpContext.Current.Session object.

This depends on cookies being enabled on the client. In my simple case it worked fine, in both Silverlight and Flex. In a real app you would probably want to use HTTPS.

I’d post the sample but unfortunately my Windows web space doesn’t support WCF.

Technorati tags: , , ,
VN:F [1.9.3_1094]
Rate this post
Rating: 6.0/10 (1 vote cast)
WCF Sessions with Silverlight and Flex, 6.0 out of 10 based on 1 rating

Related posts:

  1. Consuming .NET SOAP in Adobe Flex
  2. Microsoft Silverlight vs Adobe Flex
  3. Technology trends: Silverlight, Flex little use says Thoughtworks as it Goes Google
  4. Develop for Adobe Flex in Microsoft Visual Studio – or maybe not
  5. First steps with offline Silverlight and Live Framework

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>