The following example demonstrates how to perform a Whois query using the event driven model.
[C#]
using System; using aspNetWhois; namespace ConsoleApplication1 { class Class1 { [STAThread] static void Main(string[] args) { Whois w = new Whois( "microsoft.com", "whois.networksolutions.com" ); w.QueryEvent += new QueryEventHandler( Whois_OnQuery ); w.Query(); Console.WriteLine( "done" ); Console.ReadLine(); } static void Whois_OnQuery( object sender, QueryEventArgs e ) { Console.WriteLine( "Sever: " + e.Server ); Console.WriteLine( "DomainName: " + e.DomainName ); Console.WriteLine( e.Results ); } } }
[VB.NET]
Imports aspNetWhois Module Module1 Sub Main() Dim w As New Whois("microsoft.com", "whois.networksolutions.com") AddHandler w.QueryEvent, AddressOf Whois_OnQuery w.Query() Console.WriteLine("done") Console.ReadLine() End Sub Sub Whois_OnQuery(ByVal sender As Object, ByVal e As QueryEventArgs) Console.WriteLine(("Sever: " + e.Server)) Console.WriteLine(("DomainName: " + e.DomainName)) Console.WriteLine(e.Results) End Sub 'Whois_OnQuery End Module
Copyright 2003 - Contact: Webmaster