5,134,062 members and growing! (14,146 online)
Email Password   helpLost your password?
Web Development » Ajax and Atlas » Samples     Intermediate License: The Code Project Open License (CPOL)

An ASP.NET/AJAX Interface for Utorrent

By mattsrebatespam

An ASP.NET/AJAX interface for the utorrent application.
JScript, CSS, HTML, Windows (Windows, Win2K, WinXP, Win2003, Vista), .NET, .NET 2.0, .NET 3.0, .NET 3.5, ASP, ASP.NET, Ajax, Dev

Posted: 8 Jan 2008
Updated: 9 Apr 2008
Views: 9,345
Announcements



Search    
Advanced Search
Sitemap
4 votes for this Article.
Popularity: 2.74 Rating: 4.56 out of 5
0 votes, 0.0%
1
0 votes, 0.0%
2
1 vote, 25.0%
3
0 votes, 0.0%
4
3 votes, 75.0%
5

Introduction

I recently discovered that the bittorrent application µtorrent contained a Web interface. I eventually got it up and running and thought it was pretty neat. I wanted to customize it and make it my own. So, I searched the Web and came across a set of C# classes that hooked into the official µtorrent Web UI. The original posting is located here. In that same posting, there was also a post about an ASP.NET interface using the C# classes. I tested it out, and thought I could build my own and overcome some of the quirks it had. I also thought it would be a test of what was possible with AJAX.

Background

Getting it up and running should be fairly straightforward. What is needed is IIS, .NET 3.5, and a recent version of µtorrent with the Web UI enabled. If you have trouble running the site, you may also need the AJAX Control Toolkit.

Screenshots

Settings.PNG

Figure 1. The Settings page that is displayed when the Settings link is clicked, on first run, or when there is an error within the configuration.

Main.PNG

Figure 2. The primary page that is displayed. It contains the list of torrent types in a listbox, the torrents in a GridView, a tab control with a formview for general information and a GridView listing the files. On this page is a DropDownList to change the site theme, a link to the settings, and a link to view the logs. Also on this page is a section to start new torrents from either a URL or from a file.

General.PNG

Figure 3. After clicking the Details link from the torrent GridView, the general tab will list the information about a torrent.

Files.PNG

Figure 4. After clicking the Details link from the torrent GridView, the files tab will list the files and their status of a torrent.

Logs.PNG

Figure 5. The log viewer will list all of the information about the logs. The GridView features a DropDownList for each field that can be used to filter the logs.

Using the Code

To get started, copy the files to your server's directory. Make sure that the directory is configured as an application. Open your Web browser and point it towards the URL of the directory you created. The first time the application runs, it will detect that the settings are invalid and will prompt you to enter them. Once completed, click the Save button to commit the changes. If you wish to encrypt the information within the web.config, you can click the Link Button on the Settings page to do that. If you click it and go through the confirmation, the appSettings section of the web.config will be encrypted.

I decided to use the HTTP Compression features of this project in the hopes of speeding things up a bit.

I also added in an extremely simple HttpModule to handle the security since I did not want to mess with or rely on the IIS security. In a shared hosting environment, you also might not have easy access to that. The web.config contains an accesslist setting that is a comma delimited string of the IP addresses that can access the site. If this is not needed, then all you have to do is remove the SecurityHttpModule entry in the web.config or leave the entry on the Settings page blank.

One last option to consider. The performance of the site can be greatly improved by setting the debug setting in the web.config to false. This is mainly due to the AJAX Control Toolkit and the difference in the scripts it sends to the client.

There are still some quirks, but overall, it gets the job done; whatever that may be!

Features

Here is a list of some of the features of this project:

  • Uses AJAX to display the data from µtorrent, providing a simple Web interface that is accessible by most browsers.
  • The page is updated with UpdatePanels by an AJAX Timer control.
  • The GridViews support paging and sorting from within the Update Panel.
  • New torrents can be added via new files or via URLs.
  • An Update Progress Control is used to display a Loading... animation in the top left corner. It can be configured with stylesheets or themes.
  • I have imported all of the auto-format themes from Visual Studio into *.theme files to support Website theming.
  • The logviewer features a GridView with a neat feature - filtering. The distinct values of each column are displayed in a DropDownList in the column header that can be used to filter the data in the GridView.
  • A logging utility was created to facilitate the logging. Logs can be in either a tab delimited text file or an XML file. I have included an XSLT file to transform the XML log file from being element based to attribute based; some controls (GridView, etc.) prefer attribute based, others (TreeView) prefer element based.
  • This would be needed if you want to bind the log data to other control types.
  • A very simple security utility was created that will filter requests by IP Address.
  • A method of getting distinct values from a column in a datatable was created.

Points of Interest

None really yet. Comments and criticisms are welcome.

License

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

About the Author

mattsrebatespam


All around cool guy.
Location: United States United States

Other popular Ajax and Atlas articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
Subject  Author Date 
QuestionNeed to install uTorrentmemberMehdi Payervand22:23 26 Apr '08  
GeneraluTorrent WebUImemberReuben200511:31 18 Mar '08  
GeneralScreenshots?memberNathan Moinvaziri22:04 12 Jan '08  
GeneralRe: Screenshots?membermattsrebatespam14:47 15 Jan '08  
GeneralNeatmemberBen Daniel17:45 8 Jan '08  
GeneralRe: Neatmembermattsrebatespam7:33 9 Jan '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Apr 2008
Editor: Deeksha Shenoy
Copyright 2008 by mattsrebatespam
Everything else Copyright © CodeProject, 1999-2008
Web18 | Advertise on the Code Project