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

Zeta Links

Rate me:
Please Sign up or sign in to vote.
4.91/5 (10 votes)
22 Nov 2009CPOL5 min read 26.2K   364   22   2
A web application for generating and measuring shortcut hyperlinks, similar to bit.ly
Click for larger image

Introduction

This articles introduces a web application that allows you to create shortcut hyperlinks to arbitrary URLs and monitor their usage (i.e. who clicks it). So to some degree, this application can be compared to the various URL shorteners out there, like TinyUrl.com or bit.ly.

In contrast to the URL shorteners, my goal was not to provide shorter URLs but solely to monitor the usage of the hyperlinks.

For example, I route every download of the executable of the setup of our CMS Zeta Producer through an URL of Zeta Links. Since the setup executable cannot be tracked by web analysers like Google Analytics, this is my only chance to actually track the usage of the download hyperlink (sure, I could analyse the server log files, but that was too low-level for our scenario).

Workflow

If everything is set up correctly, you could use hyperlinks like e.g. http://www.my-cool-website.com/links/my-new-setup.

The "workflow" of the URL resolving goes like this:

  1. The administrator configures a hyperlink with the symbolic name "my-new-setup", pointing to "http://www.my-other-cool-website.com/downloads/files/setup-1.4.0.5.exe".
  2. The hyperlink is placed on a website as "http://www.my-cool-website.com/links/my-new-setup".
  3. A visitor clicks the hyperlink.
  4. Since a real resource named "my-new-setup" does not exist, the configured HTTP 404 handler is being called by IIS.
  5. The ASPX page of the configured HTTP 404 handler looks into the database for an entry with the symbolic name "my-new-setup".
  6. If the HTTP 404 handler finds an entry, the entry is loaded, its destination URL is read and a HTTP 302 redirect is sent back to the user's web browser.
  7. The hyperlink click count of the database entry is increased by one.
  8. The user's web browser opens the real destination URL.

Architecture

The application consists of the following building blocks:

  • A main web application that provides the administrative GUI to create, modify, monitor and evaluate the hyperlinks.
  • A Microsoft SQL Server database that stores the information about the hyperlinks.
  • An optional satellite web application that can be used to use Zeta Links on a remote server. More on this below.

I'll quickly discuss these parts in the following chapters.

Main Web Application

The main web application is an ASP.NET 3.5 C# project. You can deploy it to a Microsoft Windows 2003 Server or a newer server version.

You configure the application just as every other ASP.NET application, too, i.e., adjust the settings in the "web.config" file. In addition, you have to configure IIS to route every HTTP 404 request to an ASPX file of the application.

Image 2

Example of a user defined HTTP 404 error handler (sorry, German only, but you may get the idea).

SQL Server Database

The download of the application contains a SQL script for Microsoft SQL Server 2005 or higher to create an empty database.

Once it has been created, you have to configure the connection string to the database in the "web.config" file of the ASP.NET web application.

Satellite Web Application

The idea of the satellite web application was born when we first used Google AdWords to advertise products.

Since I wanted to measure who came from a click through our Google AdWords ad to the landing page, I set up a new entry in Zeta Links and entered that URL in Google AdWords. Unfortunately Google forces you to have the domain name of the URL that is being shown to the end-user of a Google AdWords ad to be the same as the actual hyperlink being redirected to.

Now I had a problem: Zeta Links was set up on domain A on server 1 whereas the destination URL for our ad was set up on domain B on server 2.

One possible solution was to simply copy the web application and the database and duplicate it on server 2. What I would have lost through this solution is the ability to have all information in one place.

So I developed a different solution:

  • Create a SOAP web service in the main web application to provide the core service of resolving a Zeta Links URL to the destination URL.
  • Create a very lightweight web application (what I call "Satellite web application") to just have a HTTP 404 redirect handler, no GUI.
  • Let the satellite web application call the SOAP web service of the main web application.
  • Configure the satellite web application on server 2.

Although this is no high-performance solution, it worked pretty well in our scenario.

So use the satellite web application if you require to have provide Zeta Links hyperlink resolving on different servers, even across data center boundaries. Ignore it otherwise.

Features

The main web application consists of a simple, but for our scenarios just right, GUI. This chapter shows you some screenshots to give you an expression of the functions.

Creating a New Hyperlink

Click for larger image

This form enables you to create a new or edit an existing hyperlink.

Displaying Statistics

Click for larger image

This page shows you the clicks on a given hyperlink within a configurable time span.

Important information include:

  • The number of clicks, including those by humans and by web crawlers/spiders
  • A graphical diagram of the clicks
  • "Notes" that enable you to place tick marks in the diagram for important events
  • Detailed information on which IP address clicked the hyperlink

The Application Code

When looking at the application code, you probably will be shocked that you discover nothing groundbreaking.

The main web application uses the "App_Themes" ASP.NET to build its GUI, so if you want to change the look and feel of the administration area, simple modify the files in this folder.

I have published this article in the "Utilities" section to indicate that the article contains little exciting code and is more of a foundation for similar projects you plan to develop.

Epilog

This article introduced a working "real-world" application to create, manage and evaluate shortcut hyperlinks.

As always, I would love to get your feedback, suggestions and enhancements. Feel free to drop me a note below in the discussions section of the article.

History

  • 2009-11-23 - First release

License

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


Written By
Chief Technology Officer Zeta Software GmbH
Germany Germany
Uwe does programming since 1989 with experiences in Assembler, C++, MFC and lots of web- and database stuff and now uses ASP.NET and C# extensively, too. He has also teached programming to students at the local university.

➡️ Give me a tip 🙂

In his free time, he does climbing, running and mountain biking. In 2012 he became a father of a cute boy and in 2014 of an awesome girl.

Some cool, free software from us:

Windows 10 Ereignisanzeige  
German Developer Community  
Free Test Management Software - Intuitive, competitive, Test Plans.  
Homepage erstellen - Intuitive, very easy to use.  
Offline-Homepage-Baukasten

Comments and Discussions

 
GeneralGreat stuff Pin
Daniel Vaughan22-Nov-09 23:37
Daniel Vaughan22-Nov-09 23:37 
GeneralRe: Great stuff Pin
Uwe Keim23-Nov-09 4:42
sitebuilderUwe Keim23-Nov-09 4:42 

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.