Reputation: 21
I'm a rookie in C# & .NET and currently developing a Broken Links Tool for a pretty big company. The main point in the application is checking there Intranet SharePoint sites.
A few weeks ago I made a proof of concept. I used a WebRequest to get the status of a current page and set the credentials with
httpReq.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
Nowadays I have to use a WebClient for the connection and in the same way it doesn't work anymore.
I also tried
Credentials = System.Net.CredentialCache.DefaultNetworkCredentials,
and
Credentials = new System.Net.NetworkCredential(username,password, "domain"),
as well
webclient.UseDefaultCredentials = true;
Why it doesn't work with the webclient?
Upvotes: 2
Views: 2456
Reputation: 751
Is your certificate valid? In any case, add:
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }
Upvotes: 1