<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Michiel van Otegem, IT Composer</title>
  <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/" />
  <link rel="self" href="http://michiel.vanotegem.nl/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-07-31T01:29:30.2051426+02:00</updated>
  <author>
    <name>Michiel van Otegem</name>
  </author>
  <subtitle />
  <id>http://michiel.vanotegem.nl/</id>
  <generator uri="http://dasblog.info/" version="2.1.8102.813">DasBlog</generator>
  <entry>
    <title>Azure Appliance</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/07/30/AzureAppliance.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,52a8be0a-08c5-47e7-9f0a-6e542fc1a4f5.aspx</id>
    <published>2010-07-31T01:29:30.2051426+02:00</published>
    <updated>2010-07-31T01:29:30.2051426+02:00</updated>
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Windows Azure" label="Windows Azure" scheme="http://michiel.vanotegem.nl/CategoryView,category,WindowsAzure.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the arely stages I've commented on Microsoft not going the right way, because a
major selling point could be that you can run Azure in the cloud or in your own data
center. That seemed not to be possible. When Azure almost went live, MS had changed
sufficiently to maybe make this possible in the future. With <a href="http://www.microsoft.com/windowsazure/appliance/">Azure
Appliance</a>, this is now definitly a reality.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=52a8be0a-08c5-47e7-9f0a-6e542fc1a4f5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Periodically calling a function in your web app</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/07/05/PeriodicallyCallingAFunctionInYourWebApp.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,c88e5ffd-0600-4bff-8c83-44b41265b345.aspx</id>
    <published>2010-07-05T12:25:18.239+02:00</published>
    <updated>2010-07-05T21:57:25.6099646+02:00</updated>
    <category term=".NET" label=".NET" scheme="http://michiel.vanotegem.nl/CategoryView,category,NET.aspx" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://michiel.vanotegem.nl/CategoryView,category,ASPNET.aspx" />
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Services" label="Services" scheme="http://michiel.vanotegem.nl/CategoryView,category,Services.aspx" />
    <category term="Windows" label="Windows" scheme="http://michiel.vanotegem.nl/CategoryView,category,Windows.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
A recurring theme in web programming is calling a function periodically and/or at
a specific date and time. This has two aspects:
</p>
        <ul>
          <li>
Calling a function on a scheduled basis 
</li>
          <li>
Making sure time-outs don't interfere</li>
        </ul>
        <p>
          <strong>Calling a function on a scheduled basis</strong>
          <br />
To be able to call a function on your web app, you first need an endpoint (a URL)
that you can call to kick the function off. In ASP.NET you can do this in several
ways:
</p>
        <ol>
          <li>
Create a page that calls the function. 
</li>
          <li>
Create a handler (ASHX) that calls the function (more efficient than a page). 
</li>
          <li>
Create a WCF service that allows calls with HTTP GET, as discussed in <a href="http://sasibhushan.com/Blog/post/WCF-Using-HTTP-GET.aspx">this
blog post by Sasi Suryadevara</a>.</li>
        </ol>
        <p>
With your endpoint in place, you can use the Windows Task Scheduler to invoke
the function at any given time and at intervals as low as one minute. With the Windows
Task Scheduler you have several options again:
</p>
        <p>
Create a VB Script that calls the URL, as discussed in <a href="http://weblogs.asp.net/steveschofield/archive/2006/09/28/Schedule-a-task-to-call-a-webpage-using-Task-scheduler_2E00_.aspx">this
blog post by Steve Schofield</a>.
</p>
        <p>
Create a PowerShell script that calls the URL (same as option 1, but more modern).
</p>
        <p>
Have the Windows Task Scheduler open Internet Explorer and open the specified URL
(e.g. <font face="Courier New">C:\PROGRA~1\INTERN~1\iexplore.exe  -extoff http://www.google.com</font>,
which starts IE without extensions). If you do this, you also need to specify that
the Task Scheduler closes IE after 1 minute, which you can do in the Settings tab
of the task (Windows 2003), or in the Trigger configuration (Windows 2008), as
shown below.
</p>
        <p>
          <img border="0" src="http://michiel.vanotegem.nl/content/binary/task1minute.png" />
          <br />
          <em>Task Settings in Windows 2003</em>
        </p>
        <p>
          <img border="0" src="http://michiel.vanotegem.nl/content/binary/trigger.png" />
          <br />
          <em>Trigger configuration in Windows 2008</em>
        </p>
        <p>
Note: In Windows 2008 the dropdowns governing duration and interval show 30 minutes
as lowest value. You can in fact change this to 1 minute by editing the text.
</p>
        <p>
          <strong>Making sure time-outs don't interfere</strong>
          <br />
A web based call is bound to time-out after a few minutes. If you task takes longer
than that, this may abort the call depending on how you programmed it, and what webserver
settings are used with regards to disconnected clients. To ensure a time-out does
not interfere, you can spawn a new thread and have it call the function. That way
the thread handling the request can return a response to the client, and the function
is carried out regardless. One issue that may arise there is that the function itself
hangs or takes too long. You may want to add logic to ensure that it's aborted after
a certain time, and add logging to notify you of this, and possibly also ensure that
the function can only be run by one caller at a time.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=c88e5ffd-0600-4bff-8c83-44b41265b345" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Note to self: Windows Shutdown Event Tracker</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/06/07/NoteToSelfWindowsShutdownEventTracker.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,55b4fa49-ff92-4e60-b3eb-f32e6374ad9e.aspx</id>
    <published>2010-06-07T18:20:01.917+02:00</published>
    <updated>2010-06-07T23:59:35.1577153+02:00</updated>
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Windows" label="Windows" scheme="http://michiel.vanotegem.nl/CategoryView,category,Windows.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I keep forgetting that I need to use GPEDIT.MSC to configure the Windows Shutdown
Event Tracker (which you <u>really</u> don't need in a virtual machine).
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=55b4fa49-ff92-4e60-b3eb-f32e6374ad9e" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Forwarding cookies</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/06/04/ForwardingCookies.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,9a66392a-057f-4378-93d5-de1580e41bcd.aspx</id>
    <published>2010-06-04T22:23:31.879+02:00</published>
    <updated>2010-06-04T22:54:30.3503326+02:00</updated>
    <category term="ASP.NET" label="ASP.NET" scheme="http://michiel.vanotegem.nl/CategoryView,category,ASPNET.aspx" />
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sometimes we come across integration scenario's that look straighforward, but where
the devil is in the details. We needed to integrate our asp.net/silverlight application
in an existing ASP "classic" site (yes, the still exist). The catch was that we needed
to call the ASP "classic" site in a server to server call to get some information,
but we needed to do this under the context of the current user. You may be wondering
why we didn't go through a shared database or someting, but the problem is that there
is little knowledge left of the old app, so changing the existing app was a no go.
</p>
        <p>
So, in order to impersonate the user, you need your server-sided request look like
that user. This means forwarding the cookies the user sends, and sending back the
cookies the server sends to the user. Below is code that demonstrates that.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">HttpWebRequest
webRequestToServer <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> (HttpWebRequest)HttpWebRequest.Create(<span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"http://somedomain/somepage.asp"</span>);
webRequestToServer.CookieContainer <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> CookieContainer(); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">foreach</span> (String
cookieKey <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">in</span> Request.Cookies)
{ HttpCookie cookie <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> Request.Cookies[cookieKey];
Cookie serverCookie <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> Cookie(cookie.Name,
cookie.Value, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"/"</span>, <span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"somedomain"</span>);
webRequestToServer.CookieContainer.Add(serverCookie); } HttpWebResponse webResponseFromServer <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> (HttpWebResponse)webRequestToServer.GetResponse(); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">foreach</span> (Cookie
serverCookie <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">in</span> webResponseFromServer.Cookies)
{ HttpCookie clientCookie <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> Response.Cookies[serverCookie.Name]; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (clientCookie
== <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>)
{ clientCookie <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> HttpCookie(serverCookie.Name);
} clientCookie.Value <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> serverCookie.Value;
clientCookie.Expires <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> serverCookie.Expires;
Response.Cookies.Add(clientCookie); } webResponseFromServer.Close();</span>
        </pre>
        <p>
This code works fine in a test environment, but there is a catch... in some cases
the domain of the server is not set in the cookie you get on the server side. The
problem with that is that when you set the domain, it doesn't correspond to what the
server expects. You can see this if you write out the cookies you send/receive (both
on the browser connection and te server-server connection) to a log or something (including
the domain. It took a while to figure out, but replacing "somedomain" with <font face="Courier New">Request.ServerVariables["LOCAL_ADDR"]</font> did
the trick. 
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=9a66392a-057f-4378-93d5-de1580e41bcd" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Microsoft and Apple promote Android phones</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/06/03/MicrosoftAndApplePromoteAndroidPhones.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,1e6a3b74-5ae4-4e5a-a93e-9c9d751a1a9c.aspx</id>
    <published>2010-06-03T10:29:27.043+02:00</published>
    <updated>2010-06-03T10:35:26.0386843+02:00</updated>
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Windows Mobile" label="Windows Mobile" scheme="http://michiel.vanotegem.nl/CategoryView,category,WindowsMobile.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
An important reason I have a Windows phone is because I have control over which applications
I buy and from whom. I decide what I can or cannot install on my phone. With
Windows Phone 7 Series Microsoft is blocking this "sideloading", so users can only
download and install new software through Marketplace. Basically Microsoft is following
the Apple iPhone model with this, and the reason is for this is clear: follow the
money. Microsoft has realized that Apple is making millions of dollars from the percentage
they get on apps sold through the app store. This is logical, because ultimately it
is not your device that makes the difference, but what you can do with it. Functionality
and content sell, it's as simple as that.
</p>
        <p>
As I said an important reason for me to have a Windows phone, and not an iPhone, was
the control I have over my device. I think I am not alone in this, and I've heard
a lot of people using Apple products (iPhone in particular) complain about
this too. It's the one thing the makes Apple impopular compared to Microsoft, so I
guess Microsoft just wants to be the impopular company. Windows Phone 7 Series
will also be impopular to vendors. On that front Microsoft is thightning the screws
as well. Microsoft now determines the hardware specs and as vendor you have little
options to alter the appearance of the OS. This means there are less options to differentiate
yourself from competitors.
</p>
        <p>
I think the new Microsoft policy will ultimately drive people away, rather than gain
momentum. It will drive people to Android based phones where phone vendors and users
are still in control. If you look at the momentum Android already has, more people
will also choose Android over iPhone for the same reasons.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=1e6a3b74-5ae4-4e5a-a93e-9c9d751a1a9c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Receiving unsecured response with WCF</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/05/28/ReceivingUnsecuredResponseWithWCF.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,2fd5a82a-8ba2-4896-b447-e86d66c990d2.aspx</id>
    <published>2010-05-28T16:09:27.8675718+02:00</published>
    <updated>2010-05-28T16:09:27.8675718+02:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="WCF" label="WCF" scheme="http://michiel.vanotegem.nl/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you're using signing or encryption on your SOAP requests, WCF exepects the response
to be signed/encrypted too. When the response is not signed/encrypted the message
encoder throws a MessageSecurityException. This is perfectly fine behavior, but in
interop scenario's can really bug you, because some WS-* implementations don't sign/encrypt
Fault messages. Now, because the message encoder throws the exception, you can't get
to the underlying SOAP fault. This means that you have no clue why you received a
fault in the first place.
</p>
        <p>
To fix this, Microsoft has provided a <a href="http://support.microsoft.com/kb/971493">hotfix</a>.
With this hotfix in place you can specify <strong>enableUnsecuredResponse="true"</strong> in
the binding configuration to allow unsecured responses. Unfortunately this means that
also valid responses don't have to be signed/encrypted, defeating the purpose of signing
and encryption altogether!
</p>
        <p>
As an alternative, you can implement your own message encoder that wraps the encoder
that is actually used. In the wrapper you can either store the received XML for
use higher up in the call stack, or retrieve the fault and throw a FaultException&lt;&gt;.
Without jumping through hoops the latter option does require your wrapper to
know about the fault types it needs to handle. With the former option you can handle
the exception higher up in the call stack by catching the MessageSecurityException
and throwing a new exception with the XML of the message as a property.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=2fd5a82a-8ba2-4896-b447-e86d66c990d2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WDI 2010 slides: ASP.NET WebForms vs. ASP.NET MVC</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/05/28/WDI2010SlidesASPNETWebFormsVsASPNETMVC.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,cbe11e95-41b7-43f1-9939-f0fe3a814499.aspx</id>
    <published>2010-05-28T15:36:20.4808867+02:00</published>
    <updated>2010-05-28T15:36:20.4808867+02:00</updated>
    <category term="ASP.NET" label="ASP.NET" scheme="http://michiel.vanotegem.nl/CategoryView,category,ASPNET.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Events" label="Events" scheme="http://michiel.vanotegem.nl/CategoryView,category,Events.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Two months ago I spoke at WDI 2010 in Warsaw, Poland on ASP.NET Web Forms vs. ASP.NET
MVC. I should have posted the slides for that session soon after, but just didn't
get around to it because of all the work thrown at me. Here they are... finally. <a href="http://michiel.vanotegem.nl/content/binary/WebForms%20vs%20MVC.pdf">Slides
(668.34 KB)</a></p>
        <p>
Thanks to the great folks organizing the conference. They took great care of me and
managed to get a good crowd together. Even though it was a pretty large audience,
the level of interaction was very good.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=cbe11e95-41b7-43f1-9939-f0fe3a814499" />
      </div>
    </content>
  </entry>
  <entry>
    <title>MVP again</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/04/02/MVPAgain.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,ea4122b2-1a86-4eb2-88bf-8dd16b237ff6.aspx</id>
    <published>2010-04-02T15:05:00.3768309+02:00</published>
    <updated>2010-04-02T15:05:00.3768309+02:00</updated>
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft has been kind enough to give me the Microsoft Most Valuable Professional
Award again. That's the 8th year I can call myself an MVP. Thanks Microsoft for the
recognition. As a token of my gratitude I've made some long overdue blog posts :).
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=ea4122b2-1a86-4eb2-88bf-8dd16b237ff6" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WSDL and WCF: WCF requires &amp;lt;sp:OnlySignEntireHeadersAndBody&amp;gt;</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/04/02/WSDLAndWCFWCFRequiresLtspOnlySignEntireHeadersAndBodygt.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,6615dee7-3844-44c7-bd5e-b359dea96cb2.aspx</id>
    <published>2010-04-02T15:01:07.711+02:00</published>
    <updated>2010-04-11T20:07:04.1733597+02:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Services" label="Services" scheme="http://michiel.vanotegem.nl/CategoryView,category,Services.aspx" />
    <category term="WCF" label="WCF" scheme="http://michiel.vanotegem.nl/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you've ever tried svcutil.exe to import WSDL which has doesn't have <font face="Courier New">&lt;sp:OnlySignEntireHeadersAndBody&gt;</font> specified
in the security policy, you'll know that this doens't fly. SvcUtil will tell you the
the security policy is not supported. So why is this? I assume this has something
to do with the a statement in paragraph 6.6 in the <a href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/ws-securitypolicy-1.2-spec-cd-01.html">WS-SecurityPolicy
specification</a>, which states:
</p>
        <p>
          <em>Setting the value of this property to 'true' mitigates against some possible re-writing
attacks.</em>
        </p>
        <p>
So apparently Microsoft decided that setting it to false is not a good idea, and decided
not to support setting it to false (omitting the element).
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=6615dee7-3844-44c7-bd5e-b359dea96cb2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Removing the ReplyTo element if it is anonymous</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/04/02/RemovingTheReplyToElementIfItIsAnonymous.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,c8f101e0-0877-44df-b4c1-041a7d14d4eb.aspx</id>
    <published>2010-04-02T14:52:50.812+02:00</published>
    <updated>2010-05-28T15:36:49.2808012+02:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Services" label="Services" scheme="http://michiel.vanotegem.nl/CategoryView,category,Services.aspx" />
    <category term="WCF" label="WCF" scheme="http://michiel.vanotegem.nl/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Talking to a non-WCF webservice is like a box of chocolates... you never know what
you're going to get. After solving the issue mentioned in my previous blog post,
I had another problem. For some reason the service didn't expect a &lt;wsa:ReplyTo&gt;
element if the value was anonymous. Later on the other party adjusted the service
so it actually worked as expected from WCF, but in the mean time I did write a message
inspector to solve the problem. Besides solving the problem it also is a nice little
example of a message inspector.
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">class</span> RemoveAnonymousReplyToMessageInspector
: IClientMessageInspector { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">const</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> ReplyToNode <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"ReplyTo"</span>; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">const</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">string</span> WSAddressingNamespace <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: #e4e4e4; FONT-FAMILY: Courier New; COLOR: #666666; FONT-SIZE: 11px">"http://www.w3.org/2005/08/addressing"</span>; <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">void</span> AfterReceiveReply(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">ref</span> System.ServiceModel.Channels.Message
reply, <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">object</span> correlationState)
{} <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
Not used for this scenario.</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">object</span> BeforeSendRequest(<span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">ref</span> System.ServiceModel.Channels.Message
request, System.ServiceModel.IClientChannel channel) { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: green; FONT-SIZE: 11px">//
This method is called before the request is sent. You can read/manipulate the message
here. // If you're using signing or encryption, that is done after this, this is the
// unencrypted/unsigned mesage.</span> request <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> RemoveAnonymousReplyTo(request); <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">null</span>;
} <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">private</span> Message
RemoveAnonymousReplyTo(Message message) { <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">if</span> (message.Headers.ReplyTo.IsAnonymous
== <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">true</span>)
{ <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">int</span> index <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span> message.Headers.FindHeader(ReplyToNode,
WSAddressingNamespace); message.Headers.RemoveAt(index); } <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">return</span> message;
} } </span>
        </pre>
        <p>
To use this, you'll need to create a class implementing the IEndpoint behavior and
add the MessageInspector in ApplyClientBehavior, as follows:
</p>
        <pre>
          <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: black; FONT-SIZE: 11px">
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">public</span>
            <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">void</span> ApplyClientBehavior(ServiceEndpoint
endpoint, ClientRuntime clientRuntime) { RemoveAnonymousReplyToMessageInspector inspector <span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 11px">=</span><span style="BACKGROUND-COLOR: transparent; FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 11px">new</span> RemoveAnonymousReplyToMessageInspector();
clientRuntime.MessageInspectors.Add(inspector); }</span>
        </pre>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=c8f101e0-0877-44df-b4c1-041a7d14d4eb" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Troubles with WCF and certificate signing</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/04/02/TroublesWithWCFAndCertificateSigning.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,ee864e59-b26a-4716-bc62-bd252a07bbe5.aspx</id>
    <published>2010-04-02T14:40:56.3509949+02:00</published>
    <updated>2010-04-02T14:40:56.3509949+02:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="WCF" label="WCF" scheme="http://michiel.vanotegem.nl/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I found myself trying to talk to a webservice using signing. It was
a WCF calling a Java webservice using a certificate to sign messages. I
kept getting the following exception message:
</p>
        <p>
          <em>The incoming message was signed with a token which was different from what used
to encrypt the body. This was not expected.</em>
        </p>
        <p>
After a wild goose chase we finally figured out that the certificate was corrupted.
Just installing the certificate again solved the issue.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=ee864e59-b26a-4716-bc62-bd252a07bbe5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Awesome mockup tool</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2010/01/24/AwesomeMockupTool.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,67cadfcd-eb82-40ff-9fd5-aca6eea083ac.aspx</id>
    <published>2010-01-24T22:37:03.327+01:00</published>
    <updated>2010-01-24T22:39:35.60075+01:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Review" label="Review" scheme="http://michiel.vanotegem.nl/CategoryView,category,Review.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've written quite a few functional designs over the years and I've found that for
users needing to validate it having visuals is key. In most cases prospective users
don't understand what they really get until they see screens. On the opposite side
of the spectrum telling developers what to do also is much easier with a screen, especially
when you are debating what would be the best and most efficient (coding wise) way
to give a user certain functionality. In these situations just getting a piece of
paper and draw is the best you can do. The last few years I've done this on and off
on my tablet. I can sketch on it, but the results are often so poor to see (and read!),
that I can't possible put it in a functional design. This is where a good mockup tool
comes in.
</p>
        <p>
A good mockup tool should make you feel like you are drawing, but provide you with
predefined controls to make your job fast and easy. Recently I came across <a href="http://www.balsamiq.com/products/mockups">Balsamiq
Mockups</a>, which is simply jaw dropping. Let's start with the result, which looks
pretty much like a hand drawn thing. At first glance that may not seem like a big
deal, but it is. It states clearly "<em>This is a mockup, the actual thing may look
different</em>". If you give a user something that looks like a screen shot, that
is what to expect to get. With this they know it will look differently when it is
done, and this also makes it much easier to debate your choices and come up with better
ideas (to quote David Platt, "Thy User Is Not You", so they will come up with stuff
you didn't even dream about).
</p>
        <p>
Ok, so the result is great, what about getting there? Well, that's a piece of cake,
really. Balsamiq is as intuitive a tool as I've seen and I was able to create a pretty
complex screen in about 10 minutes. There's a bunch of commonly used controls (and
some less common), and you can easily find what you need. Also, you can download tons
of additional controls from <a href="http://mockupstogo.net">http://mockupstogo.net</a>. Placing,
moving, resizing etc. is all very easy because of the snapping support. Want to see
for yourself? Look <a href="http://www.balsamiq.com/products/mockups/tour">here</a>.
</p>
        <p>
The last things that I find refreshing is the licensing model and fee. It only costs
$79 for a single license, and that comes with updates forever (and they update frequently,
so they say). Because the tool is already so good, this means you can use it for years,
without having to worry about support or having to get a new version.
</p>
        <p>
This is just a great tool. I am sure I will be using it often.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=67cadfcd-eb82-40ff-9fd5-aca6eea083ac" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Moonlight 2.0 released</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2009/12/21/Moonlight20Released.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,5ccc606c-7f09-423b-ac8a-f92ead8ae2e9.aspx</id>
    <published>2009-12-21T13:17:37.2008645+01:00</published>
    <updated>2009-12-21T13:17:37.2008645+01:00</updated>
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://michiel.vanotegem.nl/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just a few days ago <a href="http://go-mono.com/moonlight/">Moonlight 2.0</a> was
released. Moonlight is an open source Linux implementation of Silverlight. Moonlight
2.0 should be compatible with Silverlight 2.0, but it also already supports some Silverlight
3.0 features, such as writeable bitmaps, some out-of-browser functionality, and
the Silverlight 3 pluggable media pipeline (source: <a href="http://arstechnica.com/open-source/news/2009/12/moonlight-2-brings-silverlight-2-and-parts-of-3-to-linux.ars">ARS
Technica</a>). For us this is very interesting, because we are working on a project
involving Silverlight which will run in a public website. The client was worried about
the possible reach, and this at least opens the door. According to Microsoft 60% of
the PC's in the Netherlands now have Silverlight installed, so this is good news for
our client.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=5ccc606c-7f09-423b-ac8a-f92ead8ae2e9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Solving "The path [path] is already mapped in workspace [workspace]"</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2009/12/21/SolvingThePathPathIsAlreadyMappedInWorkspaceWorkspace.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,6d2a1db8-9976-4f16-9acc-adf5899fc362.aspx</id>
    <published>2009-12-21T12:32:52.77014+01:00</published>
    <updated>2009-12-21T12:32:52.77014+01:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Visual Studio" label="Visual Studio" scheme="http://michiel.vanotegem.nl/CategoryView,category,VisualStudio.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently we moved our projects to a new TFS server. This means that all workspaces
link to the old TFS, and you will get the error message "The path [path] is already
mapped in workspace [workspace]" when you try to add a new reference to a project
you've already worked on. I keep running into this every once in a while, because
we develop from virtual machines and we have different ones for different projects.
I also keep forgetting what to do, so this is partly a message to self.
</p>
        <p>
You can solve this by opening the Visual Studio command prompt and typing:
</p>
        <p>
          <font face="Courier New">tf workspaces /remove:[projectname]</font>
        </p>
        <p>
If you want to remove all of them (which is the case when switching to a new TFS),
you can use a wildcard, like this:
</p>
        <p>
          <font face="Courier New">tf workspaces /remove:*</font>
        </p>
        <p>
Thanks to <a href="http://gregdoesit.com/2009/01/tfs-deleting-old-workspaces/">Gergely
Orosz's post</a> on the topic.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=6d2a1db8-9976-4f16-9acc-adf5899fc362" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Book Review: Why software sucks and what you can do about it</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2009/12/16/BookReviewWhySoftwareSucksAndWhatYouCanDoAboutIt.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,39ccbf90-f724-4f79-9af3-478c6ae2ba37.aspx</id>
    <published>2009-12-16T14:46:03.15+01:00</published>
    <updated>2009-12-21T12:33:31.9912625+01:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="Review" label="Review" scheme="http://michiel.vanotegem.nl/CategoryView,category,Review.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been reading parts of this book on and off for a long time, and I've pretty much
read the whole book and some sections more than once, so it is time for a review (even
though this is an "older" book).
</p>
        <p>
If you're a software developer, this is a must read. It gives you a kick in the head
about what you should think of when you develop software. The examples David Platt
uses in this book are very striking, and will make you think about what you've built
yourself. You may feel embarrased sometimes and think "I did that too, shame on me!"
However, in the end it will make you a better developer. Platt shows very well that
IT is no longer about technology, but about the people operating the technology.
</p>
        <p>
This book is also a fun read. Platt has a good sense of humor, and in some cases
the stories he tells themselves are pretty hilarious. The only downside of the book
is that at some point repetition kicks in. The message is clear, so you want to move
on, but there are still more examples explaining the same thing.
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=39ccbf90-f724-4f79-9af3-478c6ae2ba37" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF MessageInspector Pitfall</title>
    <link rel="alternate" type="text/html" href="http://michiel.vanotegem.nl/2009/12/16/WCFMessageInspectorPitfall.aspx" />
    <id>http://michiel.vanotegem.nl/PermaLink,guid,356e9de2-da7e-4db2-ac5b-ad6f8e0de7e3.aspx</id>
    <published>2009-12-16T14:36:14.188+01:00</published>
    <updated>2009-12-16T16:39:15.048859+01:00</updated>
    <category term="Development" label="Development" scheme="http://michiel.vanotegem.nl/CategoryView,category,Development.aspx" />
    <category term="English" label="English" scheme="http://michiel.vanotegem.nl/CategoryView,category,English.aspx" />
    <category term="WCF" label="WCF" scheme="http://michiel.vanotegem.nl/CategoryView,category,WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We're doing a project where were talking to non-.NET web services and this means that
sometimes we have to see what the exact message looks like. In case you ever
need to do this: a MessageInspector will not (always) be suitable for this.
This is particularly the case where you're using a certificate to sign the message.
Signing happens after the MessageInspector is invoked, so it will just show you the
unsigned message. One thing you can do is setup a URL you can post to that logs the
incoming message as is. We have a "service" like that available to all developers,
because it is a quick and easy solution that doesn't require installing additional
tooling or modify code. Another option is to configure message logging (see the MSDN
article <a href="http://msdn.microsoft.com/en-us/library/aa702726.aspx">Recommended
Settings for Tracing and Message Logging</a>).
</p>
        <img width="0" height="0" src="http://michiel.vanotegem.nl/aggbug.ashx?id=356e9de2-da7e-4db2-ac5b-ad6f8e0de7e3" />
      </div>
    </content>
  </entry>
</feed>