NetworkCredential Cache Test : Web Client « Network « C# / C Sharp

C# / C Sharp
1. 2D Graphics
2. Class Interface
3. Collections Data Structure
4. Components
5. Data Types
6. Database ADO.net
7. Design Patterns
8. Development Class
9. Event
10. File Stream
11. Generics
12. GUI Windows Form
13. Language Basics
14. LINQ
15. Network
16. Office
17. Reflection
18. Regular Expressions
19. Security
20. Services Event
21. Thread
22. Web Services
23. Windows
24. XML
25. XML LINQ
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / C Sharp » Network » Web ClientScreenshots 
NetworkCredential Cache Test

/*
C# Network Programming 
by Richard Blum

Publisher: Sybex 
ISBN: 0782141765
*/
using System;
using System.Net;
using System.Text;

public class CredCacheTest
{
   public static void Main()
   {
      WebClient wc = new WebClient();
      string website1 = "http://remote1.ispnet.net";
      string website2 = "http://remote2.ispnet.net";
      string website3 = "http://remote3.ispnet.net/login";


      NetworkCredential nc1 = new NetworkCredential("mike""guitars");
      NetworkCredential nc2 = new NetworkCredential("evonne""singing""home");
      NetworkCredential nc3 = new NetworkCredential("alex""drums");

      CredentialCache cc = new CredentialCache();
      cc.Add(new Uri(website1)"Basic", nc1);
      cc.Add(new Uri(website2)"Basic", nc2);
      cc.Add(new Uri(website3)"Digest", nc3);

      wc.Credentials = cc;

      wc.DownloadFile(website1, "website1.htm");
      wc.DownloadFile(website2, "website2.htm");
      wc.DownloadFile(website3, "website3.htm");
   }
}


           
       
Related examples in the same category
1. Basic WebClient
2. Save web page from HttpWebResponse
3. Displays the resource specified
4. My Web Client
5. Handle network exceptionsHandle network exceptions
6. Use WebClient to download information into a fileUse WebClient to download information into a file
7. Use LastModifiedUse LastModified
8. Examine the headersExamine the headers
9. Access the InternetAccess the Internet
10. Reading Web Pages
11. NetworkCredential test
12. Download Data Test
13. Download File Test
14. Web GetWeb Get
15. Web Client Upload Values Test
16. Web Client Upload Data Test 2
17. Web Client Response Headers Test
18. Web Client Open Write Test
19. Web Client Open Read Test
w_w__w._j___a___va2_s.__c___o_m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.