EWS Authentication - UseDefaultCredentials works fine, but manually setting WebCredentials gives 401 error - any troubleshooting advice? RRS feed

  • Question

  • As the title implies, I'm looking to build an application with EWS, so I first followed the instructions online to create a sample app.  Everything worked just fine when setting UseDefaultCredentials to true, as I am developing on my work machine that is on the domain. However, since this will eventually be hosted on a server, I wanted to test the web credentials to make sure it works.  When I do new WebCredentials(username, password) it fails; I looked through the XML tracing provided and saw that while it is getting to the server, it is not authenticating me, and is throwing a 401 error. 

    My question is, is there a reason why setting the web credentials wouldn't authenticate while UseDefaultCredentials does?  I used the same username and password for my profile on the domain, which is the same credentials it picks up from my local machine.  Why would that work but manually setting them does not?  I will need to be able to use this to launch the application.

    Thanks for your help!

    Wednesday, August 9, 2017 9:05 PM

All replies

  • Check if the Username you using have ApplicationImpersonation permissions in Exchange?


    Thursday, August 10, 2017 4:27 AM