c# - EWS Certificate error: untrusted root -


i'm working on application wants implement exchange functionality. we're using ews (exchange web services).

now have following scenario:

i first had test project console application, , recieved following exception:

autodiscoverlocalexception

when using code:

service.credentials = new networkcredential("name", "password", "domain") service.autodiscoverurl("mail@address.com") 

after snooping around while i've found issue caused ssl certificate problem. went , installed certificate needed. doing caused test application work.

then went "real" application asp.net application. use same code same code.

and fails again, same error, added following code check out problem:

    ...   service.credentials = new networkcredential("name", "password", "domain")   servicepointmanager.servercertificatevalidationcallback = addressof returntrue   service.autodiscoverurl("mail@address.com")     ...      private function returntrue(byval sender object, byval certificate x509certificate, byval chain x509chain, byval sslpolicyerrors sslpolicyerrors) boolean             return true     end function 

when debugging in returntrue function found in x509chain following chainstatus :

untrustedroot {32}

so ssl certificate error again. how can be? works in console application not in our main asp.net application.

another strange thing: colleague same thing, , him works on console app , asp.net application. not have problem. though did install certificate did , have retried couple of times.

it must type of configuration i've missed. , what? , why work in console application? , why work colleague , not me?

i've seen this example doesn't seem safe way things, since working colleague of mine, don't want skip checks on ssl certificate because it's not working me.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -