Saturday, January 17, 2009

WCF Sessions Explained

@YaronNaveh

Richard Blewett has published a great post about WCF sessions. He explains how sessions are implemented in each of the bindings and how they can be used.

One addition over this post is that sessions can also be used in WCF via the asp.net compatibility mode. Here, the way to access the session is:


HttpContext.Current.Session["key"] = "value";


In this mode the session is implemented via an HTTP cookie - exactly as with classic .Net 2.0 web services / asp.net. This means that this mode is available only when hosting in IIS and using HTTP transport. This mode should be used in case backward compatibility with an old service/client is required. It should not be used with new services as it adds some overhead to the pipeline.

@YaronNaveh

What's next? get this blog rss updates or register for mail updates!

0 comments: