benmwagner
Member
I'm trying to HttpWebRequest to a dataview I created, and I keep getting a 401 I'm posting the code, and with anybody has any suggestions I appreciate it.
string uri;
uri = "http://10.4.68.69/user/system/dataviews/LN3_PLC1.xml";
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(uri);
httpRequest.Method = "GET";
httpRequest.ContentType = "text/xml";
httpRequest.AllowAutoRedirect = false;
httpRequest.KeepAlive = false;
CredentialCache newCredential = new CredentialCache();
newCredential.Add(new Uri(uri), "Basic", new NetworkCredential(myUsername, myPassword, myDomain));
httpRequest.Credentials = newCredential;
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
string uri;
uri = "http://10.4.68.69/user/system/dataviews/LN3_PLC1.xml";
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(uri);
httpRequest.Method = "GET";
httpRequest.ContentType = "text/xml";
httpRequest.AllowAutoRedirect = false;
httpRequest.KeepAlive = false;
CredentialCache newCredential = new CredentialCache();
newCredential.Add(new Uri(uri), "Basic", new NetworkCredential(myUsername, myPassword, myDomain));
httpRequest.Credentials = newCredential;
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();