Free Support Forum - aspose.com

Error connecting to Exchange Server - "Function evaluation timeout"

Hi,

I’m trying to connect to a External Exchange Server using the following code:

NetworkCredential cred = new NetworkCredential(“username”, “pass”, “domain”);
client = new Aspose.Network.Exchange.ExchangeClient(“ServerAdress”, cred);

WebProxy prox = new WebProxy(“10.0.0.1”, 8080);
prox.Credentials = new NetworkCredential(“ProxyUsername”, “ProxyPassword”,“ProxyDomain”);
prox.BypassProxyOnLocal = true;

client.Proxy = prox;

but after this when I debug the variable “client” it returns “Function evaluation timeout”.

The Exchange Server is a 2003 Exchange Server with a self-signed certificate. The variable “ServerAddress” I’m using is something like
"https://SERVERNAME/exchange/USERNAME@DOMAIN/Inbox/"

I tried the same code using our company Exchange Server and it works fine but only inside our Work Network.

Any ideas on where’s the problem lies?

Tkz

After a few more tests I can connect well to our company Exchange Server inside and outside our Work Network.

Reading the IP packages when trying to connect to the external Exchange Server:

-> OUR IP ----- DEST IP | SSL | CLIENT HELLO


->DEST IP ----- OUR IP | TLSv1| SERVER HELLO, CHANGE CHIPHER SPEC, ENCRYPED HANDSHAKE MESSAGE


->OUR IP ----- DEST IP | TCP | [ACK] Seq=154 Ack=123 Win=65398 Len=0


->OUR IP ----- DEST IP | TCP | [FIN, ACK] Seq=154 Ack=123 Win=65398 Len=0


->DEST IP ----- OUR IP | SSL | [ACK] Seq=123 Ack=155 Win=65382 Len=0


->DEST IP ----- OUR IP | SSL | [FIN, ACK] Seq=123 Ack=155 Win=65382 Len=0


Hi,

Was the problem resolved during your testing? If not, is there any exception that occurs? Could you please copy the stack trace here.

No. Only the problem accessing our company Exchange server.

The problem accessing the external Exchange Server still happens. I found out that it’s probably because the self-signed certificate of the external Exchange Server doesn’t have a Organizational Root Certificate thus I can’t install the certificate in my Trusted Root Authority.

The bug ID: 13473 could solve this problem. Got any workaround?

Tkz

Hi,

Could you please try the following workaround to avoid certificate issues.

Add below line in some init() method or constructor of the class where you are using ExchangeClient.

ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidationHandler;

And then, add the following method in the class:

private bool RemoteCertificateValidationHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true; //ignore the checks and go ahead
}

Tkz.

That works to bypass the certificate but now I get the 440 error - Login Timeout.

I use the same ServerAddress, Username, Password and Domain on browser and it works. I’m only using the following code to connect

NetworkCredential cred = new NetworkCredential(config.Username, config.Password, config.Domain);
client = new Aspose.Network.Exchange.ExchangeClient(config.ServerAdress, cred);

Do I need to set de CookieContainers like in the post

client.CookieContainer = new CookieContainer();
client.CookieContainer.Add(AuthenticateSecureOWA(serverName, domain,
userID, password));

Hello, after contacting the external Exchange Server Administrators I found that:

  • Form-based Authentication (FBA) is not active in front-ends.
  • To login in the domain it uses the Kerberos protocol.
  • OWA by ISA Server access (SSL)

for what I could see in the internet we need to have FBA active, right?


Tkz