G
Guest
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.HttpWebRequest)WebRequest.Create(sFullUri);
req.Method = "POST";
Stream stm = req.GetRequestStream();
stm.Write(dataToSend,0,dataToSend.Length);
stm.Close();
System.Net.WebResponse resp;
string ServiceAcct =
System.Configuration.ConfigurationSettings.AppSettings["ServiceAcct"];
string ServiceAcctPwd =
System.Configuration.ConfigurationSettings.AppSettings["ServiceAcctPwd"];
NetworkCredential nc = new NetworkCredential(ServiceAcct, ServiceAcctPwd, "");
req.Credentials = nc;
resp = req.GetResponse(); <!--error below...
"The remote server returned an error: (401) Unauthorized. "
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.HttpWebRequest)WebRequest.Create(sFullUri);
req.Method = "POST";
Stream stm = req.GetRequestStream();
stm.Write(dataToSend,0,dataToSend.Length);
stm.Close();
System.Net.WebResponse resp;
string ServiceAcct =
System.Configuration.ConfigurationSettings.AppSettings["ServiceAcct"];
string ServiceAcctPwd =
System.Configuration.ConfigurationSettings.AppSettings["ServiceAcctPwd"];
NetworkCredential nc = new NetworkCredential(ServiceAcct, ServiceAcctPwd, "");
req.Credentials = nc;
resp = req.GetResponse(); <!--error below...
"The remote server returned an error: (401) Unauthorized. "