M
moo
Is there a simple way to get my logon credentials to make my web request
work through our proxy server? I tried CredentialCache.DefaultCredentials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredential object specifying user, password and domain. But, I would
rather get that info automatically if possible, rather than presenting a
winform for them to type it in.
Lastly, why do both the request object and the request's proxy object have
properties for credentials? Do I need to populate them both?
Thanks,
// WebRequest
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(anyURL);
webRequest.Timeout = 10000;
webRequest.CookieContainer = cookieContainer;
// Proxy Credentials?
webRequest.Proxy = WebProxy.GetDefaultProxy();
webRequest.Proxy.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");
webRequest.Credentials = CredentialCache.DefaultCredentials;
webRequest.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");
work through our proxy server? I tried CredentialCache.DefaultCredentials,
but I get nothing back. I can get it to work if I just create a new
NetworkCredential object specifying user, password and domain. But, I would
rather get that info automatically if possible, rather than presenting a
winform for them to type it in.
Lastly, why do both the request object and the request's proxy object have
properties for credentials? Do I need to populate them both?
Thanks,
// WebRequest
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(anyURL);
webRequest.Timeout = 10000;
webRequest.CookieContainer = cookieContainer;
// Proxy Credentials?
webRequest.Proxy = WebProxy.GetDefaultProxy();
webRequest.Proxy.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");
webRequest.Credentials = CredentialCache.DefaultCredentials;
webRequest.Credentials = new
NetworkCredential("XXX","YYY","ZZZ");