In my application, I have a value ("BusinessUnit") which I want to add into every request to a web-service. One way of doing this would be to write a WCF behaviour, which would insert the value for me.
However, the one part I am not clear on is how I can get this value from my application and into the behaviour.
To illustrate my question, here is how I might implement it.
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
string businessUnit = //How do I set this to a value known by the client?
MessageHeader<string> header =
new MessageHeader<string>(businessUnit);
request.Headers.Add(
header.GetUntypedHeader("Business Unit", "http://mywebsite.com"));
}
Any ideas?