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
Find & Replace on all views, stored procedures, functions in a given database/server
C# ,framework 2.0 , bindingsource filter question
Infopath Data to SQL
How to make a web directory to be an application in Windows 2008 application server/web server?
How to format tag right?
Accidentally removed all users from Server 2008
ODBC DSN Connection refresh for multiple tables
Word unable to print picture
Move Public folders from exchange 2003 to exchange 2007
How to forward all https request by using one isp line