CredentialCache

A credential cache contains one or more NetworkCredential objects, each keyed to a particular protocol and URI prefix.


using System;
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;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.