Mixed mode authentication is when both Form Based Authentication (FBA) and Windows Authentication are enabled on the SharePoint site. I was writing some code to download a file from SharePoint in this scenario. The code needs to authenticate using Windows Authentication.
I found my solution at this post: http://buyevich.blogspot.com/2011/03/accessing-mixed-authentication-web-app.html. Essentially we need to add the header “X-FORMS_BASED_AUTH_ACCEPTED” to the request and set its value to “f”. I tested this on the WebClient class and it works!
As a side note, I found this post to make the request using FBA, i.e. with user name and password: http://dhondiyals.wordpress.com/2010/07/05/file-download-from-sharepoint-document-library-in-forms-based-authentication-scenario/. Haven’t tested so don’t know if it works – but it looks promising.
Update: And if your site is using SSL, you may run into the error below in DEV/TEST:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
In which case, try setting the ServerCertificateValidationCallback as described in this post: http://stackoverflow.com/questions/703272/could-not-establish-trust-relationship-for-ssl-tls-secure-channel-soap (it worked for me!).