Hi,
We are using an authentication string (guid) for client identification in our wcf services and for database lookups. We dont want to add this to every messagecontract.
Is there a way to do this in wcf?
Regards, Rune
Hi,
We are using an authentication string (guid) for client identification in our wcf services and for database lookups. We dont want to add this to every messagecontract.
Is there a way to do this in wcf?
Regards, Rune
The best and typical way is to add this to a header in your WCF message - and that would be perfect in a message contract.
Why do you not want to add it to the message contract??
WCF typically encourages a "per-call" methodology - you send all necessary info with your call, each and every call that is. It is discouraged to have any kind of "state" that lingers around between calls.
So again: why not just include your authentication string as a header in every message? That's the preferred way of doing things these days.
UPDATE:
Check out Nicholas Allen's blog post on Adding Headers to a Call. Besides adding them to the message contract, you could also check out the Message Inspector sample he links to, which creates a message inspector that automagically adds those header entries to each outgoing call. No code clutter, no mess, nothing - just works.