I can't seem to get this to work. The URL I want to access is protected with windows authentication. I thought that was NTLM but the following isn't working:
The error is on the last line "response = (HttpWebRespons e)request.GetRe sponse();".
I don't know if this information is usefull...:
"The remote server returned an error: (401) Unauthorized."
"System.Net.Web ExceptionStatus .ProtocolError"
"{Content-Type: text/html
Set-Cookie: SMCHALLENGE=YES ; path=/; domain=.pgalink s.com
WWW-Authenticate: Basic realm="professi onals [23:00:47:2976]"}"
Code:
string url = "http://apps.pgalinks.com/professionals/apps/directories/searchresults.cfm?entity_id=" + Convert.ToString(i);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.KeepAlive = true;
request.Accept = @"*/*";
NetworkCredential credential = new NetworkCredential("xxxx", "xxxx", "http://apps.pgalinks.com");
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri(url), "NTLM", credential);
request.Credentials = credentialCache;
HttpWebResponse response = null;
response = (HttpWebResponse)request.GetResponse();
I don't know if this information is usefull...:
"The remote server returned an error: (401) Unauthorized."
"System.Net.Web ExceptionStatus .ProtocolError"
"{Content-Type: text/html
Set-Cookie: SMCHALLENGE=YES ; path=/; domain=.pgalink s.com
WWW-Authenticate: Basic realm="professi onals [23:00:47:2976]"}"