Introduction
ASP.NET is a huge advance from previous incarnations of ASP, with one of its goals being pure HTML output that achieves maximum cross-browser compatibility. The server-side event architecture tends to engender this approach, but amid the first flush of excitement it's often forgotten that there’s still a place for rich clients, and handling data in a multitude of places. Distributed data driven applications aren’t new, but the range of possibilities and ease of development have both increased with the introduction of .NET.
This book approaches data management and data applications from several different points of view:
q Understanding the new .NET data management philosophy for both relational and XML data.
q Grasping the different techniques that is encompasses, and how they relate to real-world requirements.
q Exploring the application architecture and design implications of the .NET data management classes.
q Designing distributed data-driven ASP.NET applications that benefit from the new data management techniques.
q Examining the rich client philosophy, and how .NET can be used to bring this about.
q Demonstrating how easy it is to take advantage of several different types of client device, providing the best user experience possible for each one.
There are many books that describe the basic techniques for working with data in ASP.NET. However, this book goes not just a step further, but in fact takes you on a complete journey by exploring how to provide the user with the best possible client-side experience when they work with data. It also focuses on the server-side design and development process, such as the use of the n-tier architecture in your applications, and specific techniques like correctly managing updates to a data store by multiple concurrent users.
In this book, we assume a basic grasp of ASP.NET and the general data access techniques that the .NET Framework makes available (although we do provide some grounding to reinforce the important aspects). Where this book really is different, however, is that it is wholly aimed at seeing how we can actually build useful, interactive and efficient distributed applications.
q A voyage of exploration through almost all aspects of building ASP.NET applications that handle data and work across the Internet (or other HTTP networks such as an Intranet).
q A practical approach to building task-specific components, Web pages and Web applications based on a server running ASP.NET.
q A demonstration of what is possible with ASP.NET, without requiring special expertise, long development times or complex third-party components.
q Focused on n-tier architecture design and the way it can be coded, using SQL Server as a data source and simple Web server hardware.
q Clearly divided into chapters and sections that cover all the relevant theory and practice for the different parts of the sample application that is developed throughout the whole book.
q A source of useful techniques and snippets of code that can be re-used in your own applications.
q Written using mainly Visual Basic.NET for the code listings. However, C# versions of the samples are available for download as well as VB.NET versions.
q Hopefully, a useful and enjoyable read...
q It's not an academic text or a theory-oriented book. We describe the workings of the application in down-to-earth language, use technical terms only where necessary, and try to avoid any off-topic discussion and irrelevancies.
q It's not a reference book, in the sense that techniques we use are described where they fit into the application rather than as alphabetically organized tables.
q It's not a book about hardware performance, server optimization, or software security. We'll attempt to show how you can get the best performance from your systems when designing applications, but we won't be delving into these other areas.
q It's not a book about SQL programming, data storage theory, or complex backend systems. The techniques we use are designed to be easily translatable to any backend system to which ASP.NET has access.
q It's not a book for system administrators or database administrators. It's about programming, and aimed at developers fluent in ASP.NET.
q It's not a detective story...
This book concentrates on the use of ASP.NET versions 1.0 and 1.1 for building applications for Internet or Intranet use, and looking at the possibilities that rich clients brings to both application design and a better user experience. There often appears to be confusion over how the .NET data management and page-processing models fit into the overall distributed application architecture, how it changes this, and how it provides exciting new opportunities. So we spend some time exploring the whole architecture and design issue, and see how it can be addressed in different ways.
In particular, throughout the whole book, we attempt to provide inspiration through a range of ideas on how data can be used to drive Web applications, and how that data can be most effectively utilized at each level of the design. Web applications will usually benefit from the encapsulation of business rules into components, and the .NET Framework provides ways to build several types of components. So both the construction and use of these is demonstrated.
There is no specific focus in this book on Windows Forms or executable applications, or the client-server environment in which they normally reside. However, to work really well in a distributed Web-based environment, the client can benefit from the use of Windows Forms or other client-side executables that access the server in conjunction with an ASP.NET-based application. Again, we demonstrate this in the book.
There are many development environments for ASP.NET applications and components already available, and "on the way". The primary one is likely to be Visual Studio.NET. Traditionally ASP pages have been built in a text editor or text-based tool, and as this book concentrates on the code rather than the tool used to create it, we predominantly use just a text editor to develop ASP.NET pages. However, the features of Visual Studio.NET for building components and Windows Forms applications is covered where appropriate.
Most of the code we list in the book is Visual Basic.NET, as we feel that this gives the best opportunity for all developers. Even if you prefer to work in C# (or another language), you should be able to follow the VB.NET code quite easily. The alternative of providing listings and descriptions of the code for both languages would have meant we could get a lot less into the book overall, reducing the features we could cover and the techniques we could describe. However, the downloadable samples are provided in both VB.NET and C#. Of course, the client-side code we use in the browser is not a .NET language. Predominantly we use JavaScript here, though one example uses client-side VBScript to demonstrate that it can be done.
We also use a mixture of notations in our code. You'll see "Hungarian" notation in many places, which is aimed at making it easy to follow the code by clearly showing what data type each variable refers to. However, under .NET, Microsoft are suggesting that we should all move away from this notation style - but they don’t say what we should move to. Suggestions can be sent to the authors (via our usual feedback address feedback@daveandal.net), as can your comments if you feel strongly about any other issue we've brought up here or throughout the remainder of the book.
This book is for developers who want to get to grips with ASP.NET for building distributed data-driven applications, especially where they have a requirement for displaying and processing data in a wide range of different ways. In other words, developers who require more that just simple "read and update" scenarios, but instead must tackle building truly distributed applications.
We'd like to think that you have a passion for ASP.NET, though in reality there may be one or two people who just use it because they have to. Either way, ASP.NET is what this book is about, and what we expect you to be familiar with. You'll also need to have some database experience, and the appropriate software and hardware available as well. We summarize all the requirements in the next two sections.
This book is aimed at developers who have learned about .NET, and in particular ASP.NET, and are probably experienced in Web application development using previous versions of ASP. However, knowledge of Web application fundamentals (perhaps from another environment) and a firm grasp of the basics of ASP.NET will suffice.
Also, knowledge of programming using VB.NET (or at least a reasonable grasp of VB.NET as it relates to the predecessor VBScript) will be useful. If you are fluent in C#, and prefer to use that, the techniques we demonstrate can easily be implemented in that (or any other) .NET language. The downloadable samples files are supplied in both VB and C# versions as well.
The sample files can be downloaded from http://www.daveandal.net/books/4923/
Basically, all you need is a text-editor and a server running version 1.0 or 1.1 of the .NET framework. However, you will also need to obtain and install the Microsoft Mobile Internet Toolkit (MIT) to be able to run all the examples.
To get the .NET Framework, go to http://msdn.microsoft.com/net/.
Get the MIT from http://msdn.microsoft.com/vstudio/nextgen/device/mitdefault.asp.
A database server is also required - though it can be on the same server as the .NET framework. The database we use in the book is Microsoft SQL Server, though you can use any database to which you can connect from ASP.NET and within which you can create stored procedures.
We use Microsoft Visual Studio.NET to create and compile the .NET components, but it is not a requirement as you can compile the class files from the command line instead. Neither is it our main development environment for ASP.NET pages as we use "inline" format, rather than the "code behind" format that VS.NET demands. For the Windows Forms application we do use Visual Studio.NET, although the downloadable code will work without it. However you won't be able to view the design of the forms.
Information on Visual Studio is available from http://msdn.microsoft.com/vstudio/.
To test the pages in different environments you might want to install several browsers. We tested the code in Opera and Netscape Navigator, as well as the Nokia mobile phone emulator.
Navigator is available from http://home.netscape.com/computing/download/index.html
Opera is available from http://www.opera.com/
The DeckIt Mobile Emulator is available from http://www.pyweb.com/tools/
The Nokia MIT is available from http://forum.nokia.com/
The OpenWave Mobile Toolkit is available from http://openwave.com/
Dave Sussman is a hacker in the traditional sense of the word. That's someone who likes playing with code and working out how things work, which is why he spends much of his life working with beta software. Luckily this coincides with writing about new technologies, giving him an output for his poor English and grammar. He lives in a small village in the Oxfordshire countryside. Like many programmers everywhere he has an expensive hi-fi, a big TV and no life.
You can contact Dave through his own company, Ipona Limited: davids@ipona.co.uk.
Alex Homer is a computer geek and Web developer with a passion for ASP.NET. Although he has to spend some time doing real work (a bit of consultancy and training, and the occasional conference session), most of his days are absorbed in playing with the latest Microsoft Web technology and then writing about it. Living in the picturesque wilderness of the Derbyshire Dales in England, he is well away from the demands of the real world - with only an Internet connection to maintain some distant representation of normality. But, hey, what else could you want from life?
You can contact Alex through his own software company, Stonebroom Limited: alex@stonebroom.com.