I'm trying to make a webrequest to another server on our webfarm (to synch
the cache as explained in http://www.eggheadcafe.com/articles/20030420.asp)
but I'm getting a 401 unauthorized error.
We are using service accounts for the app to run under which I thought would
work in setting the webrequest's credentials property but with no luck....
HttpWebRequest req = (System.Net.Htt pWebRequest)Web Request.Create( sFullUri);
req.Method = "POST";
Stream stm = req.GetRequestS tream();
stm.Write(dataT oSend,0,dataToS end.Length);
stm.Close();
System.Net.WebR esponse resp;
string ServiceAcct =
System.Configur ation.Configura tionSettings.Ap pSettings["ServiceAcc t"];
string ServiceAcctPwd =
System.Configur ation.Configura tionSettings.Ap pSettings["ServiceAcctPwd "];
NetworkCredenti al nc = new NetworkCredenti al(ServiceAcct, ServiceAcctPwd, "");
req.Credentials = nc;
resp = req.GetResponse (); <!--error below...
"The remote server returned an error: (401) Unauthorized. "