D
Dave
Hi, I'm trying to make a call to url using the code below. The url points to XML files in a virtual folder (under basic auth) my dev server and returns XML to my local machine OK. But when I run this code on the same server as where the url points to, it works once then returns on repeated requests..
"The remote server returned an error: (401) Unauthorized.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://mydevserv:1027/Secure/Reports/14330.XML")
HttpContext cxt = HttpContext.Current
NetworkCredential nc = new NetworkCredential(cxt.Request.ServerVariables["AUTH_USER"], cxt.Request.ServerVariables["AUTH_PASSWORD"],"")
req.Credentials = nc
WebResponse resp = req.GetResponse(); <--ERRO
StreamReader sr = new StreamReader(resp.GetResponseStream())
string strStream = sr.ReadToEnd();
"The remote server returned an error: (401) Unauthorized.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://mydevserv:1027/Secure/Reports/14330.XML")
HttpContext cxt = HttpContext.Current
NetworkCredential nc = new NetworkCredential(cxt.Request.ServerVariables["AUTH_USER"], cxt.Request.ServerVariables["AUTH_PASSWORD"],"")
req.Credentials = nc
WebResponse resp = req.GetResponse(); <--ERRO
StreamReader sr = new StreamReader(resp.GetResponseStream())
string strStream = sr.ReadToEnd();