CredentialCache
In this chapter you will learn:
Use CredentialCache to store password
A credential cache contains one or more NetworkCredential
objects, each keyed to a particular protocol and URI prefix.
using System;/* j a va2s. c o m*/
using System.Net;
using System.IO;
using System.Linq;
using System.Text;
class Program
{
static void Main()
{
CredentialCache cache = new CredentialCache();
Uri prefix = new Uri("http://exchange.somedomain.com");
cache.Add(prefix, "Digest", new NetworkCredential("joe", "passwd"));
cache.Add(prefix, "Negotiate", new NetworkCredential("joe", "passwd"));
WebClient wc = new WebClient();
wc.Credentials = cache;
}
}
Next chapter...
What you will learn in the next chapter:
Home » C# Tutorial » Network