Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

401 unauthorized exception because of special char in password? #302

Open
maslewandowski opened this issue Jun 22, 2023 · 0 comments
Open

Comments

@maslewandowski
Copy link

I'm trying to get access to an exchange 2016 server using EWS in a .net 7 console application.
There seems to be problem with one account and I already investigated much time on research but I can't fix this.

The password contains two "special" characters.
For security reasons let me reduce the password to those two characters:

string password = "\"";

This code works properly with all other accs of the domain, except the one with the above mentioned password:

_exchangeService = new ExchangeService();
_exchangeService.TraceEnabled = true;
_exchangeService.TraceFlags = TraceFlags.All;
_exchangeService.Credentials = new WebCredentials(_sender, DecryptPassword(), "domain");
_exchangeService.Url = new Uri(_mailServerAdress);
_exchangeService.UseDefaultCredentials = false;

var message = new EmailMessage(_exchangeService);
message.Subject = "Test";
message.Body = "Test";
message.ToRecipients.Add(recipient);
message.SendAndSaveCopy();

Am I missing something here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant