Monthly Archives: November 2007

Controlling HTTP Cookies on a WCF Client

A few customers have tried to control their HTTP Cookie headers from a smart client (using a previously cached cookie for example). The common experience has been “I enabled AllowCookies=true, and added the cookie using HttpRequestMessageProperty.Headers.Add. But somehow my cookie didn’t get included in my request.”

This is because “allowCookies” is a somewhat unfortunate name. When setting “allowCookies=true” on your HTTP-based binding (WsHttpBinding, BasicHttpBinding, etc), what you are indicating is that you want WCF to manage the cookie headers for you. That means that WCF will create CookieContainer, associate it with any IChannelFactory that is created from the binding, and then use that CookieContainer for all outgoing HttpWebRequests. The end result of this setup is that the user has zero control over his cookies, since the CookieContainer is taking over all management (including echoing server cookies if and only if a cookie was sent in an earlier response to that factory).

To cut a long explanation short, if you want to manipulate cookies on the client, then you (somewhat unintuitively) need to ensure that allowCookies=false.  In this manner, you are taking full responsibility for all cookies sent on that channel (in all cases, including capturing response cookies and echoing appropriately).

Diddy Riese (Los Angeles, CA)


When Lauren‘s Mom moved to West LA, I was introduced to a little ice cream shop near UCLA.  They advertise snow cones, cookies, and ice cream on the menu.  But what has made Diddy Riese famous was their $1 ice cream sandwiches: two freshly baked cookies with a scoop of ice cream sandwiched beteen them. 

It’s a simple formula really, but their execution is flawless. Even after their price increase to $1.50 they’re still a bargain (the price increase was accompanied by a very apologetic note that explained the economics of the dairy industry and how a new contract requires some costs to be regrettably be passed along to the customer). You can choose two different cookies for the top and bottom if you’d like and choose from an assortment of Dreyer’s flavors.

After my first hit I was hooked, and since then Diddy Riese has become a necessary stop anytime I visit LA (its one block proximity to an In and Out makes for a tasty fast-food combo visit). 

The “classic sandwich” is oatmeal raisin cookies with vanilla ice cream. Today I had chocolate chip cookies with strawberry ice cream. Soft, fresh from the oven cookies. Ice cream soft enough for a sandwich but cold enough to avoid a quick melt.  There are few better things I can imagine on a sunny LA afternoon.


Diddy Riese
926 Broxton Ave
Los Angeles, CA 90024
(310) 208-0448

Junior's (Los Angeles, CA)


Thanksgiving. Day of cranberry salsa and closed restaurants. We had the bright idea to get In and Out for lunch today. Fortunately we remembered to call on our way to see if they were open. No dice. So we drove around briefly near Helene’s place and found that Junior’s Deli is open on Thanksgiving until 5PM.

I first went to Junior’s on New Year’s Day after a nasty bout with the stomach flu (it was the first solid food I had in 3 days). So while any memories there are suspect, I had a positive recollection of the food. When you first walk into Junior’s you are greeted by a large display case of pastries, including a few kinds of tasty rugelach. Further inside is a fairly standard diner setup, with a NY deli-inspired menu.

Given the large Thanksgiving dinner awaiting us tonight, Shawn, Lauren and I shared a tuna melt and some cheese blintzes.

The tuna melt was grilled on fresh Jewish rye bread, stuffed with freshly mixed albacore tuna salad and the obligatory melted chedder. All in all a very solid tuna melt. We ordered “mini potato pancakes” in place of fries. I was expecting smaller versions of the classic latkes; flat and shredded potato based. Instead we were treated to an entirely new dish — asteroid-shaped potato puffs that were briefly deep fried. Crispy on the outside and a little mushy on the inside they were closer to hush puppies than potato pancakes, but thoroughly enjoyable.

Since we’d likely have our fill of turkey this evening, we opted for a set of cheese blintzes instead of a turkey sandwich. Original plan was to order a mix of cheese and blueberry blintzes, but they were out of blueberry. So we got a trio of cheese blintzes. They were fairly large, stuffed with a sweet ricotta filling, and seared on the outside shell. The blintz sheet was soft (outside of the crispy top searings), and the filling was sweet while remaining on the savory side of the palette.  Personally I would have blintz overload after one of them, so it was fortunate that we were sharing 🙂


Overall Junior’s provided a relaxed, tasty lunch and I’ll be happy to return for more deli and ruggies next time we’re in Westwood.

2379 Westwood Blvd
Los Angeles, CA 90064
(310) 475-5771

Bombay Café (Los Angeles, CA)


When I told Don that I was headed to LA for Thanksgiving, he gave a list of his favorite food stops. A couple of them are very close to Helene’s place in Westwood, including Bombay Café.

Bombay Café is a nouveau Indian restaurant (it’s to Indian as El Camino is to Mexican). But they did stock the classic Indian brews, including a large Taj Mahal for my brother-in-law:

There were far too many good looking dishes on the menu to choose from, but since there were four of us we managed a reasonable initial sampling. We opted for one familiar dish that the entire Lavoie family enjoys: Saag Paneer. Bombay Café makes their paneer in-house, and it is notably fresh. The spinach was piping hot, a little sweet, and satisfied my spinach craving. That being said, it wasn’t overly distinctive and could have used a bit more spice.



The highlight of the meal for me was the Chicken Frankie. Frankies are supposedly a popular Indian street food (we haven’t made it to the sub-continent yet, so will have to wait for personal verification).  I can say that the one at Bombay Café was awesome — a dark masala sauce wrapped in a chapati “burrito” form.

I had never heard of white poppy seeds, and so couldn’t pass up the Goan Shrimp Curry (served in a puree of white poppy seeds, coconut and cilantro). It was Helene’s favorite of the pack, and my second favorite after the Frankie. If you like coconut, shrimp, and Indian food then you should definitely get the Goan.


We were deciding on one of the two eggplant dishes, and asked our server who recommended the Eggplant Deva (Japanese eggplant layered with fennel-laced tomato sauce and garlic-ginger infused yogurt). She said it was her favorite dish on the menu. It was good, but next time I’ll try the Baingan Bharta, as I just couldn’t shake the fact that it tasted very much like a pizza with an eggplant crust.


Overall a very enjoyable experience — good food, good beer, good family fun 🙂


Bombay Café
12021 West Pico Boulevard
Los Angeles, CA 90025
(310) 473-3388

Performance Characteristics of WCF Encoders

As part of the Framework, we ship 3 MessageEncoders (accessible through the relevate subclass of MessageEncodingBindingElement):

  1. Text – The “classic” web services encoder. Uses a Text-based (UTF-8 by default) XML encoding. This is the default encoder used by BasicHttpBinding and WsHttpBinding
  2. MTOM – An interoperable format (though less broadly supported then text) that allows for a more optimized transmission of binary blobs, as they don’t get base64 encoded.
  3. Binary –  A WCF-specific format that avoids base64 encoding your binary blobs, and also uses a dictionary-based algorithm to avoid data duplication. Binary supports “Session Encoders” that get smarter about data usage over the course of the session (through pattern recognition). This is the default encoder used by NetTcpBinding and NetNamedPipeBinding

I often get asked “which encoder is the fastest?” (and then “by how much?” :)). As always, the first principle of performance is to measure and tune your exact scenarios to determine if this is a bottleneck for you. That being said, here are some notes on the performance characteristics of our built-in Message Encoders.

Broadly speaking, encoders can impact your performance along two axis: size of encoded messages, and CPU load required to generate/consume those encoded messages.

In general, binary has the fastest encoding/decoding speed since it has less to do (usually because there is less data to read/write). This has to do with the dictionary-based optimization characteristics. The speedup is greater over TCP/NamedPipes since the encoder can recognize patterns (and negotiate optimizations) over the course of the session. If both participants are using WCF, then binary is a natural choice for production. (Note that during development, Text may be useful for debugging purposes).

Both binary and MTOM yield much faster processing of binary data (by avoiding the base64 process as well as the associated size bloat). Binary achieves this with inline binary blobs. The MTOM format achieves this through an inline base64 stub that references the binary blob outside of the Infoset. In both cases, the user model is abstracted from this detail and they will “appear” inline through the encoder.

If you do not have any binary data involved, MTOM will actually be slower than text since it had the extra overlead of packaging and processing the Message within a MIME document. However, if there is enough binary data in the document then the savings from avoiding base64 encoding can make up for this added overhead.

We spent a lot of engineering effort tuning the performance of our UTF-8 Text encoder, so you will see better performance over UTF-8 then the Unicode variations. And as to whether you should use Text or MTOM for interoperable endpoints, the guidance above should help with gut feel, but please measure your scenarios!

New York State of Mind

Gio and I saw Billy Joel last night at the Key Arena. Wow. He still sounded great, had great crowd engagement, and even hit his own high notes on An Innocent Man. First concert in awhile where I’ve been on the younger side of the audience though 🙂