Microsoft
Software
Hardware
Network
Question : .Net C# Getting the error: The remote server returned an error: (401) Unauthorized. when using OWA Outlook Web Access
I am using the following code in C# .Net to access OWA (outlook web server)
I am able to go to the url using the username and password to access OWA, but when I try using the code below I receive the error. The remote server returned an error: (401) Unauthorized.
System.Net.HttpWebRequest Request;
System.Net.WebResponse Response;
System.Net.CredentialCache
MyCredentialCache;
string strSourceURI = "
https://webmail.datacert.
com/exchan
ge/
";//"UR
L to my email object testing.eml";
string strUserName = "username";
string strPassword = "password";
string strDomain = "domainname";
MyCredentialCache = new System.Net.CredentialCache
();
MyCredentialCache.Add(new System.Uri(strSourceURI),
"NTLM",new System.Net.NetworkCredenti
al(strUser
Name, strPassword, strDomain) );
// Create the HttpWebRequest object.
Request = (System.Net.HttpWebRequest
)HttpWebRe
quest.Crea
te(strSour
ceURI);
// Add the network credentials to the request.
Request.Credentials = MyCredentialCache;
// Specify the SEARCH method.
Request.Method = "SEARCH";
// Send the DELETE method request.
Response = (System.Net.HttpWebRespons
e)Request.
GetRespons
e();
Answer : .Net C# Getting the error: The remote server returned an error: (401) Unauthorized. when using OWA Outlook Web Access
Here are some protocols to consider. Still don't know what you are trying to do or I would provide links to some examples.
CDO
WEBDAV
MAPI
Random Solutions
MS Project 2007, How to add a Column 'Percent'
script will not removed mapped drive from user profiles
How to build a control by its name as a string
New RAM Causing laptop to shut down
MS Word conversion to Adobe
Regional settings GREEK , decimal separator "," sql server 2000, But does not update a textbox tha binds to a float field,C# framework 2.0
need install windows from lan
Can Access 2003 and 2007 coexist in peace on the same machine?
Drawing and Scolling in Windows C# - ClientRectangle? Paint?
Small Business Server 2008 - TASK Scheduler Errors