You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

How to create a custom message handler?

RavenDB client uses HttpClient under the hood to talk to RavenDB server through HTTP. In order to customize how it should deal with sending and receiving requests you might overwrite its default message handler using DocumentStore.HttpMessageHandlerFactory.


To properly setup windows auth with unsafe connection sharing use the following code:

documentStore.HttpMessageHandlerFactory = () => new WebRequestHandler
    UnsafeAuthenticatedConnectionSharing = true,
    PreAuthenticate = true