I am trying to create an ASP.NET website (.NET 3.5) to connect to our Exchange 2010 server through Exchange web services, I can connect to EWS when I determine the username, password and domain for authentication, but I would like if possible, do not include registration data in your code.
In IIS, I have included integrated Windows authentication for the site, in the web.config of the site I have <authentication mode="Windows"/> .
The following code is what I bit:
svc.UseDefaultCredentials = True svc.Credentials = New WebCredentials() svc.Url = New Uri(svcURL)
With the above code, I get a message:
When creating a request as an account that does not have a mailbox, you must specify the primary SMTP address of the mailbox for any folder IDs.
When I try to use svc.Credentials = CredentialCache.DefaultNetworkCredentials (instead of svc.Credentials = New WebCredentials() ), I get an error message:
Cannot pass an object of type "System.Net.SystemNetworkCredential" to enter "Microsoft.Exchange.WebServices.Data.ExchangeCredentials".
As already mentioned, the only thing that worked was to determine the user credentials for authentication using the svc.Credentials = New WebCredentials("username","password","domain") user details, which I would not do: svc.Credentials = New WebCredentials("username","password","domain")
Could anyone authenticate with EWS using the credentials of the currently logged in user on the ASP.NET website?