Share via


Toolbox

ASP.NET Controls, FTP, and More

Scott Mitchell

Contents

Make Your ASP.NET App More Appealing
Comprehensive FTP Library Is User Friendly
Rich Imaging Support
The Bookshelf

Make Your ASP.NET App More Appealing

Since most ASP.NET applications are merely data entry forms accessible over the Internet, developers usually have their time monopolized by important yet bland issues such as reporting, data-entry form design, and input validation. This focus is evident in third-party control suites, which typically have a grid control as their flagship product.

While an application's substance is paramount, the importance of an intuitive and aesthetic user interface should not be discounted. You won't find any grid components in the ASPxperience Suite 1.1 by Developer Express, but you will find 18 Web controls that are designed to enhance your Web application's aesthetics and usability by presenting information in interesting and attractive ways.

The 18 controls that make up the suite specialize in navigation, layout, and application flow control. For example, the ASPxDataView control displays tabular data in columns and rows but, unlike ASP.NET's blocky GridView control, the ASPxDataView control can span data across multiple columns or rows, allows for a fine detail of customization, and offers an improved paging interface. The ASPxSiteMapControl offers a variety of eye-pleasing ways to display the Web site's navigational structure, which can be specified programmatically or from a hierarchical data source, such as an XmlDataSource or SiteMapDataSource.

The controls that impressed me the most in the ASPxperience Suite were the ASPxCloudControl and ASPxTimer controls. The ASPxCloudControl renders a tag cloud, which is a visual metaphor that succinctly depicts a weighted list. Each item in a tag cloud is associated with some value, and the greater that value is with respect to other items in the cloud, the larger that item's text appears. This interface enables a visitor to quickly ascertain how the value of one item compares to the others. The ASPxTimer control creates a client-side timer component without requiring you to write any timer-related JavaScript code. Moreover, the rendered timer component includes a client-side API for starting and stopping the timer as well as responding to tick events.

The controls' appearances are very customizable and can be configured programmatically or declaratively and with the aid of formatting wizards. Furthermore, many of the ASPxperience Suite controls use or can be configured to use AJAX techniques to enhance the user experience. All major browsers are supported, including Internet Explorer®, Firefox, Netscape, Opera, and Safari.

Price: $249 per developer license; $299 for a license plus source code.

www.devexpress.com

The Intuitive ASPxCloudControl

The Intuitive ASPxCloudControl  (Click the image for a larger view)

Comprehensive FTP Library Is User Friendly

The File Transfer Protocol (FTP) is an open and well-known protocol for exchanging files between a server and a client over a network. There are many server and client implementations available. Microsoft® Internet Information Services (IIS), for example, includes an FTP service, and there are plenty of both free and commercial standalone FTP client applications. Even your Web browser can double as an FTP client.

While the abundance of FTP client applications is beneficial for end users, as developers we are more interested in communicating with FTP servers through programmatic interfaces. The Microsoft .NET 2.0 Framework includes classes for sending and retrieving files from an FTP server (see the FtpWebRequest and FtpWebResponse classes in the System.Net namespace). There are also third-party FTP libraries that add features not found in the .NET Framework. One such library is FTP for .NET 2.0 by Rebex, which provides a comprehensive API for connecting, uploading, and downloading files to and from an FTP server, with support for both .NET and .NET Compact Framework applications. FTP for .NET allows for synchronous and asynchronous operations, binary and ASCII file transfers, and non-transfer related FTP functionality, such as creating and deleting files and folders on the FTP server.

What I liked best about FTP for .NET was its concise, easy-to-use API. The Ftp class makes up the core of the API. To start communicating with an FTP server, simply create an instance of this class and call its Connect method, passing in the FTP server name and port number. If you are working with an FTP server that does not allow anonymous visitors, use the Login method to provide your credentials. Uploading and downloading files is as simple as calling the PutFile and GetFile methods. The same straightforward API extends to FTP for .NET's other functions. In short, this product makes it possible to tackle common and tricky FTP tasks alike in a few lines of terse, readable code. And to help you get started, FTP for .NET ships with several helpful examples that showcase using the library in both command-line and Windows® Forms applications.

Keep in mind that FTP is inherently insecure since all communications occur in plaintext. There are two alternative FTP specifications that add secure communications: FTP/SSL, also called FTP over SSL; and SSH File Transfer Protocol (SFTP). Rebex offers a separate product line that adds support for the FTP/SSL and SFTP standards.

Price: $249 per developer license; source code available for $999 per license.

  (Click the image for a larger view)

Rich Imaging Support

If you have ever created or worked on an application that needed to manipulate or allow users to edit images, there's a strong chance you have spent time poring through the classes in the System.Drawing namespace. Sadly, .NET's built-in imaging classes provide such a low-level interface that even the simplest tasks can require a large amount of time, effort, and code. Moreover, the framework includes only limited image-related user interface controls. The good news is that there are many third-party products that abstract the complexities of GDI+ in powerful and easy-to-use imaging APIs. One such product is DotImage Photo Pro 5.0 by Atalasoft, which includes a robust imaging API as well as imaging controls for Windows Forms and ASP.NET applications.

To start working with an image, simply create a new Workspace object and use its Open method, passing in the path or URL to the image. Once a Workspace has been loaded, use its ApplyCommand method to perform any number of image manipulations. These include effects such as adding a drop shadow or applying a grayscale, cropping, adjusting the transparency, changing the palette, resizing, and performing transformations (image skewing, rotating, flipping, and so on). This succinct and uncomplicated API results in tight, readable code. For example, opening an image and saving a thumbnail requires just three lines of code.

DotImage Photo Pro also includes UI imaging controls for both Web and Windows applications. To allow users to interact with images through a Windows application, add a WorkspaceViewer control to the form. As the user interacts with the image—moving the mouse, clicking on the image, defining a region on the image, and so forth—the control raises corresponding events. Images can be displayed in a Web application using either ASP.NET's built-in Image control or DotImage's WebImageViewer control. In addition to displaying images, the WebImageViewer can also create a rich image editing interface that utilizes AJAX techniques to efficiently communicate with the Web server when opening, saving, and manipulating images.

DotImage Photo Pro works with a variety of popular image codecs (JPEG, PNG, BMP, TIFF, GIF, PCX, and PSD, to name a few). The API was designed with extensibility in mind and allows custom encoders and decoders to be created and plugged in at runtime. There are also add-ons that can be purchased from Atalasoft's Web site that add features such as barcode recognition, optical character recognition, and advanced photo effects.

Price: $999 per developer license.

www.atalasoft.com

DotImage Poto Pro Offers a Robust Imaging API

DotImage Poto Pro Offers a Robust Imaging API  (Click the image for a larger view)

The Bookshelf

In my job as a consultant and trainer I frequently meet with companies whose existing line-of-business application is unable to meet their current needs. In some cases it's because the application is not scaling; in others, the company is extending its products or services and needs to update the application to address these new offerings. These meetings usually leave me amazed at just how easy it is to create databases and data-driven applications with Microsoft's developer tools.

The scalability, extensibility, and maintainability of a database are directly related to the quality of its design. As such, it is important that the developers creating the data model for a data-driven application have a solid understanding of the principles of good design. Pro SQL Server 2005 Database Design and Optimization, by Louis Davidson, Kevin Kline, and Kurt Windisch (Apress, 2006), introduces readers to these principles and illustrates how to implement them in SQL Server™ 2005. The first half of the book explores database design concepts such as entities, relations, data integrity, and constraints.

The book's second half looks at database design outside of the data model. Chapter seven, for example, examines security topics such as authentication, permissions, encryption, and auditing. Other chapters focus on query optimization and index creation and usage. I found the chapter on code-level architectural decisions to be the most interesting, as it included discussions on ad hoc SQL queries versus stored procedures and choosing between T-SQL and CLR database objects.

Database design is vital to creating a data-driven application. Regardless of your expertise, I am confident that Pro SQL Server 2005 Database Design and Optimization will help improve your database design skills and applications.

Price: $59.99.

www.apress.com

  

Send your questions and comments for Scott to toolsmm@microsoft.com.

Scott Mitchell, author of numerous books and founder of 4GuysFromRolla.com, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. Reach him at Mitchell@4guysfromrolla.com or via his blog at ScottOnWriting.NET.

All prices were confirmed at press time and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions of Microsoft.

MSDN Magazine does not make any representation or warranty, express or implied with respect to any code or other information herein. MSDN Magazine disclaims any liability whatsoever for any use of such code or other information.