WebIndexer
Description
WebIndexer creates a searchable index of the World Wide
Web starting at the URL that you specify.
This source code was published as part of an article that
originally appeared in ActiveWeb Developer. Copyright
Pinnacle Publishing Inc. All rights reserved.
Running WebIndexer
Launch WebIndexer. Enter a URL in the URL textbox and
specify the number of hops. Choosing zero hops means
that only the starting URL will be indexed, while choosing
one hop means that the URLs that the starting URL hyperlinks
to will be also be indexed. Since Web pages tend to contain
a large number of hyperlinks, keep the number of hops low,
or the indexing process will take too long. Specify a timeout
and press the Creat Index button.
Since the index is built in a separate thread, you can search
for words while it's being built. Type one or more words in the
Search For textbox and select the And radio button to find
pages with all the words, or select the Or radio button for
pages containing at least one. The search is fast enough that
it's repeated every time a character changes in the Search
For textbox. Click an underlined search hit to display the
page in the embedded Web browser.
The C# and .NET concepts illustrated by this source code include:
- Using the WebRequest class to download web pages
- Extracting hyperlinks from Web pages using regular expressions
- Threads
Requirements
This source code was developed with Microsoft Visual Studio 2005. Fractal Viewer
requires .Net 2.0.
Source Code