C# WebClient UseDefaultCredentials
Description
WebClient UseDefaultCredentials
Gets or sets a Boolean
value that controls whether the DefaultCredentials are sent with requests.
Syntax
WebClient.UseDefaultCredentials
has the following syntax.
public bool UseDefaultCredentials { get; set; }
Example
The following code example demonstrates setting this property.
using System;// w w w. j av a 2 s .c o m
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
WebClient client = new WebClient();
Uri uri = new Uri("http://www.Yourfakeserver.com/fileUpload.aspx");
client.UseDefaultCredentials = true;
Console.WriteLine("File upload started.");
}
}
The code above generates the following result.