Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

DesktopBrowser - A Web Based File Explorer for Media Desktops

0.00/5 (No votes)
25 Jun 2011 1  
A presentation of DesktopBrowser open-source project, a web based file explorer for media desktops.
Screenshot

Introduction

For a long time, I've been having difficulties using my living-room 'media center' desktop, particularly, using Windows explorer. It seems that standard Windows operating systems were not designed to be viewed on a 46" LCD screen with 1920x1080 HD resolution. Zooming is not possible, filtering and sorting is very limited, and many features that I thought were pretty basic were missing.

After thinking about it for a while, I asked myself, why doesn't the web have that problem? I can easily browse the web on my media center desktop, browsers today are very powerful, and provide very good user experience. So why can't I browse through my files the same way I browse through the web?

That is why I wrote DesktopBrowser, it's a simple web app, that runs locally on IIS Express, and gives you the ability to browse through your local and network drives, from within your browser. It's an open-source project, maintained at GoogleCode.

Features

  • Quick filter (client side)
  • Image view - with preview of first photo from each folder
  • Sorting by any column(s)
  • Folder size calculation
  • Next/previous sibling folder navigation
  • Browser back, forward and bookmarks are fully supported
  • Columns: Name, Last Modified, Size, Extension

Prerequisites

To run the app, you'll need to install the following prerequisites:

To use the code, you'll also need:

Using the Code

This project is written as a web application project. It uses SharpKit to maintain client-side code in C#. Please install it before building the project.

The project contains 3 basic components:

  • SiteService - A service that provides all APIs to be invoked by the server / client
  • Default.aspx page - Main page for the file explorer, it receives a SiteService request object in the URL
  • Default.aspx.cs file - JavaScript code-behind that provides client-side behaviors, maintained in C# using SharpKit

When a browser navigates to Default.aspx, the page parses the query string into the SiteRequest object. It invokes the GetFiles method on the SiteService class using the specified request, and renders the output using response got from the service.

var service = new SiteService();
var req = SiteRequest.Load(Context.Request);
var file = service.GetFile(req.Path);
req.Path = file.Path;
if (!file.IsFolder)
{
    service.Execute(file.Path);
}
else
{
    var folder = file;
    FilesGrid1.Files = service.GetFiles(req);
}

Points of Interest

I've used IIS Express in this project, to overcome certain security issues regarding process execution. This project can run on standard IIS, but some features will not work.

SharpKit is a very helpful tool when writing client-side code, maintaining the code is easy because code is compiled.

To make the app more responsive, I've used Response.BufferOutput = false. This sends the page as it renders. I also used System.IO.DirectoryInfo.EnumerateFiles() method. The combination of these two methods gave out responsive UI even in big and complicated requests.

History

  • 25th June, 2011: Initial post 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here