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
SharePoint Services Site Image
Need to query if a field starts with "+1"
InfoPath 2007: Error on file open, "InfoPath cannot create a new, blank form"
How do I use a user-defined function in Access
Why am I getting this clipboard warning message on IE8?
Excel Zone Expert Discussion, Number 12
Building VPN with DI524 dlink router
Making a bootable Windows XP flash drive
IIS administrator in Exchange Server
Outlook autodiscover popup issue - SBS 2008/Exchange 2007