EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized
2014-05-27 17:44
1361 查看
Following is my code.
I tried changing the code line as below and I get another Error ....
"The remote server returned an error: (401) Unauthorized."
How do i resolve. and what is difference between NetworkCredential and WebCredentials ?
This is Resolved.
I figure out that the problem was in code line
service.Credentials = new NetworkCredential("xx@xx.com", "xx","xxxxxxxx");
Instead of xx@xx.com it should be just username 'xx'. That Solved.
Phew!!
Regards
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.TraceEnabled = true; service.Credentials = new WebCredentials("xx@xx.com", "xxxx123"); service.Url = new Uri("https://mail.xxxxxx.com/EWS/Exchange.asmx"); FolderView v = new FolderView(5); ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback; service.FindFolders(WellKnownFolderName.Inbox, v); //Error on above line.
I tried changing the code line as below and I get another Error ....
service.Credentials = new NetworkCredential("xx@xx.com", "xx","xxxxxxxx");
"The remote server returned an error: (401) Unauthorized."
How do i resolve. and what is difference between NetworkCredential and WebCredentials ?
This is Resolved.
I figure out that the problem was in code line
service.Credentials = new NetworkCredential("xx@xx.com", "xx","xxxxxxxx");
Instead of xx@xx.com it should be just username 'xx'. That Solved.
Phew!!
Regards
相关文章推荐
- 调用WCF出现 The remote server returned an error: (401) Unauthorized. 错误
- WCF The remote server returned an error: (400) Bad Request
- The remote server returned an error: (400) Bad Request. --- RosettaNet 3.3
- The remote server returned an error: (403) Forbidden.
- Call Azure Queue get "The remote server returned an error: (400) Bad Request."
- The remote server returned an error: (403) Forbidden.
- request 报错The remote server returned an error: (415) Unsupported Media Type.
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 解决办法
- request 报错The remote server returned an error: (415) Unsupported Media Type.
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
- HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.
- Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 解决办法
- IIS error:The remote server returned an error: NotFound
- Silverlight + WCF错误“The remote server returned an error: NotFound.”的解决方法
- The remote server returned an error: NotFound.
- WCF 中,出现The remote server returned an unexpected response: (400) Bad Request.
- WP8 调用webservice 错误 The remote server returned an error: NotFound 解决
- SharePoint Log - "The remote server returned an error: (409) Conflict."
- Silverlight + WCF错误“The remote server returned an error: NotFound.”的解决方法
- The remote server returned an error: (415) Cannot process the message because the content type 'text