Click here to Skip to main content
15,861,340 members
Articles / Web Development / ASP.NET

Address Book Grabber

Rate me:
Please Sign up or sign in to vote.
1.53/5 (7 votes)
26 Feb 2008CPOL1 min read 61.3K   1.6K   77   3
Address Book Grabber

I got two ways to grab the address book from any website....

1. By using DownloadData and UploadValues Methods of WebClient Class

The basic algorithm is:

  1. Create WebClient class object to get the methods for sending and receiving data from a resource identified by a URL.
  2. Set the user agent info in the header and set the proxy setting.
  3. Download the login page.
  4. By the Regular Expression, extract the desired name value collection which we have to send with login information, for example, user name, password, etc. to get the address book.
  5. Again, set the header information such as user agent, etc.
  6. Upload the page and get the cookies information.
  7. Download the address book page.
  8. Create the name value collection.
  9. Set the header information such as cookies info, user agent, etc.
  10. Upload the page with name value collection - it will return address book in byte array format.

Please refer to the attached code file: Contact_Importer_.aspx.cs.zip.

2. By using the HTTPWebRequest and HTTPWebResponse HTTP Classes of the .NET Framework

The basic algorithm is:

  1. The first step for getting a web page is to instantiate an HttpWebRequest object. This occurs when invoking the static Create() method of the WebRequest class.
  2. Set request header fields and user credentials.
  3. Get response from the server in stream object and add user credential information with it.
  4. Send further Request by sending cookie within the request.
  5. Again use create() method to open address book page.
  6. Get the response by sending cookie information with the request, it will return address book page in byte array format.

Please refer to the attached code file: Contact_Page_Importer.cs.zip.

History

  • 27th February, 2008: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Persistent System Limited
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCould not download Contact_Importer_ - 2.31 KB Pin
Andrew G Avelin15-Mar-12 20:12
Andrew G Avelin15-Mar-12 20:12 
GeneralNeed more dialog Pin
Donsw8-Jan-09 5:52
Donsw8-Jan-09 5:52 
Questionasp.net Pin
reminston4-Sep-08 1:15
reminston4-Sep-08 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.