100% found this document useful (10 votes)
57 views

Download Complete Programming the Web with Visual Basic NET 1st Edition Lynn Torkelson PDF for All Chapters

Programming

Uploaded by

rezayipearo2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (10 votes)
57 views

Download Complete Programming the Web with Visual Basic NET 1st Edition Lynn Torkelson PDF for All Chapters

Programming

Uploaded by

rezayipearo2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

Download the full version of the ebook now at ebookultra.

com

Programming the Web with Visual Basic NET 1st


Edition Lynn Torkelson

https://ebookultra.com/download/programming-the-
web-with-visual-basic-net-1st-edition-lynn-
torkelson/

Explore and download more ebook at https://ebookultra.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Practical Database Programming with Visual Basic NET


Second Edition Ying Bai(Auth.)

https://ebookultra.com/download/practical-database-programming-with-
visual-basic-net-second-edition-ying-baiauth/

ebookultra.com

An Introduction to Object Oriented Programming with Visual


Basic NET 1st Edition Dan Clark

https://ebookultra.com/download/an-introduction-to-object-oriented-
programming-with-visual-basic-net-1st-edition-dan-clark/

ebookultra.com

Programming Microsoft Visual Basic NET Version 2003


Francesco Balena

https://ebookultra.com/download/programming-microsoft-visual-basic-
net-version-2003-francesco-balena/

ebookultra.com

Programming Microsoft SQL Server 2000 with Microsoft


Visual Basic NET 1st edition Edition Rick Dobson

https://ebookultra.com/download/programming-microsoft-sql-
server-2000-with-microsoft-visual-basic-net-1st-edition-edition-rick-
dobson/
ebookultra.com
Programming with Microsoft Visual Basic 2012 6th Edition
Diane Zak

https://ebookultra.com/download/programming-with-microsoft-visual-
basic-2012-6th-edition-diane-zak/

ebookultra.com

Windows Game Programming with Visual Basic and DirectX 1st


Edition Freeze

https://ebookultra.com/download/windows-game-programming-with-visual-
basic-and-directx-1st-edition-freeze/

ebookultra.com

Visual C Net programming 1st Edition Harold Davis

https://ebookultra.com/download/visual-c-net-programming-1st-edition-
harold-davis/

ebookultra.com

An introduction to programming using Visual Basic 2008


with Visual Studio Expression edition DVD Schneider

https://ebookultra.com/download/an-introduction-to-programming-using-
visual-basic-2008-with-visual-studio-expression-edition-dvd-schneider/

ebookultra.com

Visual Basic NET A Beginner s Guide Herbert Schildt

https://ebookultra.com/download/visual-basic-net-a-beginner-s-guide-
herbert-schildt/

ebookultra.com
Programming the Web with Visual Basic NET 1st Edition
Lynn Torkelson Digital Instant Download
Author(s): Lynn Torkelson, Constance Petersen, Zac Torkelson (auth.)
ISBN(s): 9781590590270, 1590590279
Edition: 1
File Details: PDF, 37.37 MB
Year: 2002
Language: english
Programming the Web
with Visual Basic .NET
LYNN IDRKELSON, CONSTANCE PETERSEN, AND ZAC IDRKELSON

APress Media, LLC


Programming the Web with Visual Basic .NET
Copyright © 2002 Apress
Originally published by SoftMedia Artisans, Inc.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and
the publisher.

ISBN 978-1-59059-027-0 ISBN 978-1-4302-1102-0 (eBook)


DOI 10.1007/978-1-4302-1102-0
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.

Technical Reviewer: Scott Stab bert


Editorial Directors: Dan Appleman, Peter Blackburn, Gary Cornell, Jason Gilmore, Simon Hayes,
Karen Watterson, John Zukowski
Managing Editor: Grace Wong
Project Manager and Development Editor: Tracy Brown Collins
Copy Editor: Tom Gillen of Gillen Editorial, Inc.
Production Editor: Kari Brooks
Compositor: Susan Glinert
Artist: Cara Brunk
Indexer: Carol Burbo
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Marketing Manager: Stephanie Rodriguez

In the United States: phone 1-800-SPRINGER, email orders@springer-ny. com, or visit


http:llw.;w.springer-ny.com. Outside the United States: fax+49 6221345229, email
orders@springer. de, or visit http: I lw.;w. springer. de.

For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219,
Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info@apress. com, or visit
http: I IWYM. apress. com.

The information in this book is distributed on an "as is" basis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author nor Apress shall
have any liability to any person or entity with respect to any loss or damage caused or alleged to
be caused directly or indirectly by the information contained in this work.

The source code for this book is available to readers at http: I !w.NJ. apress. com in the Downloads
section. You will need to answer questions pertaining to this book in order to successfully download
the code.
To Allen Ray Torkelson, father and grandfather, who taught his
family to seek out the great challenges that life offers, and who,
by example, instilled the courage to meet those challenges. And
to the memory ofHelen Lindseth Torkelson, mother and
grandmother, who taught us that making beautiful music
requires not only talent but also study and practice.

To Freda Suzanne Petersen, mother and grandmother, who


proudly encouraged her daughter's "mechanically inclined"
nature and taught us all to cherish family times. And to the
memory of Steve Arthur Petersen, father and grandfather, who
found joy in crafting precision machine parts and taught us to
strive for accuracy and perfection in our own craft.
Contents at a Glance

Foreword ................................................................................................................ xiii


About the Authors ............................................................................................... xv
Acknowledgments ................................................................................................ xvii
Introduction ....................................................................................................... xix
Chapter 1 Meeting the Challenges of the Web ................................ 1
Chapter 2 Creating a Web Application ............................................. 37
Chapter 3 Creating a Web Page ............................................................. 93
Chapter 4 Using the HTML Controls .................................................. 139
Chapter 5 Using the Web Server Controls ..................................... 223
Chapter 6 Using the Validation Controls ..................................... 303
Chapter 7 Using Data-Bound Controls ............................................. 341
Chapter 8 Developing an XML Web Service ..................................... 401
Chapter 9 Accessing Relational Data ............................................. 453
Chapter 10 Creating a User Control .................................................. 531
Chapter 11 Creating a Rendered Control ......................................... 575
Chapter 12 Creating a Composite Control ....................................... 613
Chapter 13 Building a Web Application ........................................... 639
Chapter 14 Configuring and Deploying a Web Application ...... 719

Chapter 15 Creating a Web Site ........................................................... 767

Appendix A Web Design and Usability: Tips and Tricks ........... 833
Appendix B HTML Quick Reference ........................................................ 851
Appendix C XML Quick Reference ........................................................... 863
Appendix D Setting Up Your Own Development Server ................. 875
Index ...................................................................................................................... 879

v
Contents
Foreword ............................................................................................................... xiii

About the Authors ....................................................................................... xv

Acknowledgments .......................................................................................... xvii

Introduction .................................................................................................. xix

Chapter 1 Meeting the Challenges of the Web .................. 1


What Are the Challenges of Web Development? ....................................... 1
Creating Multitiered Applications for the Web .................................. 2
Using HTML and XML ............................................................................................. 9
Programming in the Internet Environment .............................................. 17
ASP. NET Names paces ........................................................................................... 27
Recap ........................................................................................................................ 36

Chapter 2 Creating a Web Application .................................. 37


Starting a Web Project ................................................................................... 38
Using the Global. asax File .......................................................................... 53
Cascading Style Sheets ................................................................................... 69
Instrumentation and Tracing ........................................................................ 83
Recap ........................................................................................................................ 91

Chapter 3 Creating a Web Page .................................................... 93


Understanding the ASP. NET Control Tree ................................................ 94
Unraveling the Page Processing Sequence ............................................ 101
Understanding Web Form Classes ............................................................... 120
Recap ...................................................................................................................... 137

vii
Contents

Chapter 4 Using the HTML Controls ......................................... 139


The HTMLControls Namespace ......................................................................... 140
Using Image Controls ...................................................................................... 144
Using Container Controls ............................................................................. 152
Using Input Controls ...................................................................................... 201
Using Client Events ........................................................................................ 217
Recap ...................................................................................................................... 221

Chapter 5 Using the Web Server Controls ......................... 223


Understanding the Capabilities of Web Server Controls .............. 224
The Web Controls Namespace ......................................................................... 228
Using Basic Web Server Controls .............................................................. 242
Using Complex Web Server Controls ......................................................... 285
Recap ...................................................................................................................... 301

Chapter 6 Using the Validation Controls ......................... 303


Adding a Validation Control to a Web Page ........................................ 304
The Validation Base Classes ...................................................................... 307
Validating Required Fields ......................................................................... 311
Validat:j.ng Field Formats ............................................................................. 312
Validating Field Values ............................................................................... 321
Performing Custom Validation .................................................................... 326
Using the ValidationSummary Control ..................................................... 332
Recap ...................................................................................................................... 339

Chapter 7 Using Data-Bound Controls ................................... 341


Data Binding ....................................................................................................... 341
Using the Collection Controls .................................................................. 350
Recap ...................................................................................................................... 399

Chapter 8 Developing an XML Web Service ........................ .401


Describing an XML Web Service .................................................................. 402
Communicating with an XML Web Service ................................................ .405
Locating an XML Web Service ...................................................................... 409
Creating an XML Web Service ...................................................................... 411
Accessing an XML Web Service .................................................................... 423
Returning an Array from a XML Web Method .......................................... 433
Returning a Structure from a Web Method ............................................ 435
viii
Contents

Exchanging Objects with a Web Method .................................................. 437


Using SOAP Headers ......................................................................................... 439
Recap ...................................................................................................................... 451

Chapter 9 Accessing Relational Data ................................... 453


What Is Special About ADO.NET? ............................................................... 454
The ADO.NET DataSet Class .......................................................................... 455
Data Providers .................................................................................................. 458
Accessing a Database from a Dataset .................................................... 462
Populating a Database ................................................................................... 483
Using a Data Reader ....................................................................................... 496
Improving Column Names via Mapping ...................................................... 501
Using Data Views .............................................................................................. 504
Accessing a Dataset via an XML Web Service ..................................... 508
Editing a Database Table from a DataGrid ......................................... 509
Validating Data Table Entries ................................................................. 517
Recap ...................................................................................................................... 529

Chapter 10 Creating a User Control ........................................ 531


Understanding User Controls ...................................................................... 532
Creating a Simple User Control ............................................................... 537
Exposing User Control Properties ........................................................... 542
Changing Content Dynamically .................................................................... 547
Handling User Control Client Events .................................................... 553
Converting a Web Form to a User Control ............................................ 560
Caching Output for Reuse ............................................................................ 561
Recap ...................................................................................................................... 573

Chapter 11 Creating a Rendered Control .............................. 575


Creating a Web Control Library ............................................................... 575
Creating a Simple Rendered Control ...................................................... 577
Registering and Using a Custom Control .............................................. 585
Using Web Control Properties .................................................................... 594
Rendering Content Changes Dynamically ................................................ 598
Handling PostBack Events ............................................................................ 602
Recap ...................................................................................................................... 610

ix
Contents

Chapter 12 Creating a Composite Control ............................ 613


Creating a Simple Composite Control ..................................................... 613
Varying Styles Within a Composite Control ........................................ 617
Raising an Event from a Composite Control ........................................ 624
Creating a Template Control ...................................................................... 630
Recap ...................................................................................................................... 636

Chapter 13 Building a Web Application ................................. 639


Updating a Database from a Web Application ...................................... 640
Authenticating a Visitor ............................................................................. 665
Viewing Database Information from a Web Site ................................. 692
Recap ...................................................................................................................... 717

Chapter 14 Configuring and Deploying


a Web Application ........................................................ 719
Configuring a Web Application .................................................................. 720
Securing a Web Application ......................................................................... 738
Deploying a Web Application ...................................................................... 751
Recap ...................................................................................................................... 765

Chapter 15 Creating a Web Site ................................................... 767

Working with a Professional Designer ................................................... 767


Implementing a Web Design ........................................................................... 775
Encapsulating Design Elements in Controls ........................................ 784
Personalizing Web Pages ............................................................................... 809
Reading Database Information Efficiently .......................................... 817
Inviting Spiders} Crawlers} and Surfers ............................................ 825
Recap ...................................................................................................................... 831

Appendix A Web Design and Usability:


Tips and Tricks ............................................................. 833
Gain Trust Through Clear Writing ........................................................... 833
Create Effective} Useful Web Links ....................................................... 838
Make Web Pages Easy to Navigate .............................................................. 841
Add Value with a Web Site Search Tool ................................................. 843
Produce Fast-Loading} High-Quality Graphics ................................... 845
Make Your Web Site More Accessible ....................................................... 848
Recap ...................................................................................................................... 849

X
Contents

Appendix 8 HTML Quick Reference ................................................ 851


The Doctype Declaration .............................................................................. 851
The html Section .............................................................................................. 852
The head Section .............................................................................................. 852
The body Section .............................................................................................. 854
Formatting Web Pages with HTML ............................................................... 854

Appendix C XML Quick Reference .................................................. 863


Document Object Model ................................................................................... 864
Node Trees ........................................................................................................... 864
Nodes ...................................................................................................................... 866

Appendix D Setting Up Your Own


Development Server ..................................................... 875
Hardware Requirements for Windows 2000 Server .............................. 878
Source Code Control ....................................................................................... 878

Index ................................................................................................................... 879

xi
Foreword
Doing the Web Right
I REMEMBER MY FIRST encounter with Web development (about 2,500 years ago in
Internet time). It was an awesome experience. Suddenly it became simple to
publish my brilliant thoughts and musings for all the world to see, without resorting
to chain letters or anonymous letters to the editor. No matter that no one cared
about reading my drivel; it was enough to have it out there.
The downside to this magic was the tools necessary to make it happen. Notepad
to write code? Early Web servers that required deep magic to get set up and keep
operating? A little later, scripting code? Sheesh. The tools available at the time cer-
tainly took the luster off the whole experience. They easily set computer science
back at least fifteen years.
Later, in the middle ages of the Web, more robust tools like Microsoft's ASP and
Sun's JSP made Web application development possible and feasible. But writing or
maintaining a Web site based on ASP, with HTML interspersed with evil scripting
code, was enough to make real developers gag.
Now, early in the newest millennium, Microsoft has ushered in the new age of
the Internet with ASP. NET and VB. NET. This ain't your great grandma's Web anymore!
Web development is now possible with real programming languages and tools, real
objects in the object-oriented programming sense, and state of the art debugging
and profiling tools .. NET is just too cool, and it makes development fun again.
However, the cost of this white magic is complexity.. NET is big. Even the small
corner of .NET that directly applies to Web application development with VB.NET
is enough to present a long and difficult learning curve. Even if you have years of VB
and Web experience, you're in for some hard work just getting up to speed on these
new technologies.
That's why I was excited to learn that Constance, Lynn, and Zac were under-
taking this book. I've known Constance a long time, and she and Lynn and I have
worked together on a couple oflarge projects. They're the nicest, smartest people
I could ever hope to work with. Constance is one of the best user interface people
around, and Lynn and Zac are world-class coders. It just blows me away thatthey're
a single family. How did so much technical talent end up in one place, in one
family? (Hey, Constance and Lynn, either of you have any single sisters?)
The world is awash in .NET, VB. NET, and ASP. NET books. Do we really need
another one? My answer is a most emphatic yes when the book is conceived and
written by so talented a group of authors .. NET is a huge subject, and one of the
most impressive things about this book is that the authors have extracted and

xiii
Foreword

focused on the topics that are most important as you develop your ASP. NET Web
applications using VB. NET.
Once you understand the concepts in this book, you'll even be ready to make
sense of the more esoteric corners of .NET when your app needs specialized features.
For example, security is now an important feature of any application, all the more
so if it's on the Web where malicious hackers can bang away at it, probing for vul-
nerabilities. With this book, you'll gain an understanding of the security features of
ASP. NET for Web applications, enough to secure most apps. But, when you create
an app that requires extraordinary protection, you can build on the knowledge and
wisdom herein to achieve the system requirements. All this for less than the price
of a nice dinner!
Take this book, study its sage advice, and soak up the wisdom you'll find here.
Then get out there and take part in building the next, new generation of the Web.
And have fun doing it!

Don Kiely
Third Sector Technologies
Fairbanks, Alaska
June 2002

xiv
About the Authors
THE THREE co-AUTHORS of this book are related in both life and business. Constance
Petersen and her husband, Lynn Torkelson, are the founders of SoftMedia Artisans,
Inc. The third author is their fourteen-year-old son, Zachary Torkelson.

Constance began using Visual Basic with


VB3 and was a co-author of Visual Basic 4
How-To (Waite Group, 1995). The creative force
within SoftMediaArtisans, she has written many
articles on Web design and usability. You can find
reprints of some of those articles at
http: I /www. smartisans .com. When she is not
writing or working on a Web site, Constance can
often be found photographing the wonders of
nature with her digital camera.

Lynn is the lead author of this book. A


grizzled veteran of assembly language and
C programming, he was introduced to VB3 by
his wife, Constance. When VB4 added class
files, Lynn finally began to appreciate the
possibilities of the language. Before ditching
the corporate world to go into business with
Constance, Lynn also did tours of duty as a
manager of software development and of
software quality. When time permits, he enjoys
playing duplicate bridge.

XV
About the Authors

Zac began investigating the joys of


programming at the age of ten and gradually
intensified his interest. He soon learned VB5,
then VB6 and C++. After discovering the works of
Dan Appleman on the company shelves, Zac began
using the WmdowsAPI extensively in his programs.
Upon the arrival of the first beta version of .NET,
Zac switched to Visual Basic .NET and C#. These
days he particularly likes to program multiplayer
online games with cool graphics and sound. Zac
can be lured away from the keyboard to go
boating or skiing (depending upon the weather)
or to play a rousing game of Ping-Pong.

About the Technical Reviewer


Since 1993, Scott Stab bert has worked at Microsoft-as a developer support
engineer for ASP and Visual lnterdev teams, teaching testing automation, and
other positions. He is currently a developer trainer specializing in ASP .NET.

xvi
Acknowledgments
THE FOLKS AT APRESS provided wonderful assistance and support throughout the
writing and production of this book. Thanks to Dan Appleman not only for encour-
aging us to take on this project and serving as editorial director, but also for writing
the Visual Basic classics that we've relied upon in the past. Thanks to Gary Cornell
and Karen Watterson for helping to get this project started on the right footing and
for making sure we covered the right topics. Even the Apress T-shirts look great!
From beginning to end, Tracy Brown, our project manager, worked closely with
us in our efforts to make sure that this book would be as valuable to the readers as
possible. Like a circus juggler, she kept many balls in the air and never let one drop.
Thanks, Tracy. It was a pleasure to work with you!
And thanks also to Scott Stab bert, technical reviewer extraordinaire. Scott not
only possesses the in-depth ASP. NET knowledge of a Microsoft insider, but his
teaching experience has shown him which aspects of this great new technology
have proved to be stumbling blocks for students. Scott's many suggestions and
explanations proved immensely valuable to us.
Heartfelt thanks to Tom Gillen whose highly skilled and good-humored editing
made the entire copyedit process fun. Tom deflated the onerous effects of our
worst cliches, cheered us on for mentioning octothorpes and singer/songwriter
James McMurtry, and, whenever we asked, patiently explained the reasons behind
his trickier edits.
Thanks to Kari Brooks, our production manager, for all the thought and care
she put into making sure our book looks great in print. Also, thanks to the dynamic
marketing duo of Stephanies-Stephanie Rodriguez and Stephanie Parker.
Stephanie Rodriguez is the marketing and public relations manager for Apress, and
she adroitly handles the marketing of our book in the Americas. Stephanie Parker is
the marketing and publicity coordinator for Springer-Verlag London limited, and, just
as adroitly, she handles the marketing of our book in Europe and the rest of the world.
We also wish to thank the many people not directly involved in the production
of this book whose dedication to software quality, performance, and usability have
informed and inspired us. Prominent in this group are Bob Arnson, Alan Cooper,
Quentin (Q) Correll, J. D. Hildebrand, Don Kiely, Deborah Kurata, Jim Kyle,
Jakob Nielsen, Sue Petersen, Karl Peterson, Dan Rogers, Jeff Russell, Bill Storage,
Zane Thomas, Kevin Weeks, and Andrew J. Wozniewicz.
And finally, thanks Nick and Daniel for your patience and support over the past
months. Let's get to know each other again this summer!

xvii
Introduction
IT'S NO SECRET that the Internet has exploded upon the scene during the past few
years. Computer applications are changing dramatically as a result. We come face
to face with the Internet almost every day, and none of us can escape noticing its
shortcomings. It's too slow. Links often take us to nowhere. Applications are infuri-
atingly obtuse. Much of the content is sheer nonsense (or worse).
And yet, we use the Internet more and more. Why? Because of the information
it holds that we can't easily get any other way. Because of the items it offers for sale
that we can't buy anywhere else. Because of the opportunity it gives us to commu-
nicate with folks all over the world who share our interests.
If we use the Internet now, under these conditions, imagine how important it is
going to be five, ten, or twenty years in the future. When a super-fast network con-
nects the world community and good Web applications routinely provide valuable
services in an intelligent way, we programmers will be able to look back on these days
with the satisfaction of those who helped to build something quite remarkable.
Many of the applications and services that we build now will still be in use far into
the future, if we build them right.

NOTE In truth, the applications we build today may still be around


for many years even if we build them wrong. Witness the fact that
organizations spent billions of dollars to correct the two-digit date
problem just before the tum of the century. The authors realize that no
capable programmer used raw two-digit dates after 1970 unless forced
to do so by some pointy-haired manager, but most of us who have
programmed professionally for a while realize that the percentage of
managers in the pointy-haired category is terrifyingly high. So here is
our advice: when ordered to waste your valuable time by writing an
application poorly. either ignore your manager and do tlze job right,
or quit and go to work for a competitor who wants it done right.

A major reason for the unsatisfactory quality of current Web applications is the
weakness of the tools that have been available to develop them. Professional
software developers steeped in the knowledge of object -oriented programming
view the sight of intermingled content and script with disgust. Many talented
developers have avoided Web development because they could not stomach the

xix
Introduction

requirement to write bad code. But, with Microsoft's release of the .NET Framework,
you no longer need to write bad code to program the Web.
In this book, we aim to demonstrate that you can use Visual Basic .NET to develop
efficient Web applications that provide a good experience for the visitor. And you can
write those Web applications using sound, object-oriented programming techniques.

The .NET Revolution


To call the objectives of the .NET Framework ambitious would be a gross under-
statement. Visualize a world in which programs written in any programming
language and running under any operating system can work together searnlessly to
solve problems and provide information. And imagine that people trust those
programs not to alter any information outside of their well-defined boundaries.
And imagine that new programs are distributed without ever breaking a program
previously installed. The .NET Framework aims to make all of these miracles-
and "more-possible.
Clearly a tremendous amount of work lies ahead to turn the .NET vision into
reality. The authors of this book plan to participate in that work, and we hope to
entice you into participating in it too.
With Microsoft's release of the .NET Framework and Visual Studio .NET, you
now possess all the tools you need to build robust and efficient Web applications
using your programming language of choice. If, like most programmers interested
in productivity, your programming language of choice is Visual Basic, you can now
develop Web applications in Visual Basic .NET using the same tools and techniques
that you use to build desktop applications. As a matter of fact, that's exactly what
this book is about.

Is This Book for You?


To begin with, we assume that you already know how to program desktop appli-
cations in Visual Basic. Not only that, but we assume that you know Visual Basic
.NET to be much more than just an upgrade to Visual Basic 6 and, further, that you
are prepared to program using Visual Basic .NET. If you haven't yet looked into the
new features and language changes introduced by Visual Basic .NET, you should
read Moving to VB. NET: Strategies, Concepts, and Code by Dan Appleman (Apress,
2001) before you read this book.
On the other hand, we do not assume that you already know how to program
Web applications. Because the .NET Framework simply blows away the archaic
tools that were previously available to Web programmers, we predict that many
Visual Basic programmers who successfully avoided Web programming in the past

XX
Introduction

will now bring their expertise to the Web. And, if you're among those unfortunate
souls who have developed (or, even worse, maintained) Web applications using
embedded script, you will truly be in a position to appreciate the new tools.
We believe that the transition to the .NET Framework will take considerable
time. Visual Basic .NET does not create COM components, and we expect many
existing Visual Basic 6 COM components to have a long lifetime. We also anticipate
that quite a few organizations will continue to use Visual Basic 6 to develop COM
components until the .NET Framework becomes pervasive. If you are like most
programmers (including us), you will be itching to experiment with Visual Basic
.NET even if your organization hasn't yet adopted it as an official programming
language. Creating your own Web site offers a perfect opportunity to get your feet
wet with Visual Basic .NET. And it's great fun!
Is this book for you? If you are an experienced Visual Basic programmer inter-
ested in programming the Web, the answer is an emphatic yes.

What Does This Book Cover?


If you are still reading this, you probably appreciate that the territory covered by
the .NET Framework is so vast that no book can explain more than a small part of it.
In addition to the development environment provided by Visual Studio .NET and
Visual Basic .NET, the portion of the .NET Framework that concerns us most directly in
this book is called ASP.NET. We discuss many of the ASP. NET base classes and
explain, in words and by example, how to use those classes to build good Web
applications. If you haven't done Web programming before, some of the uses will
surprise you.
Because many Web applications depend upon relational databases for data
storage, we also show how to use certain ADO.NET classes. For a complete expli-
cation of this subject, read Database Programming with Visual Basic .NET by
Carsten Thomsen (Apress, 2001).
When you finish this book, you will understand how to build and deploy Web
applications using Visual Basic .NET. You will also have seen examples of how to
code many procedures generally needed in Web applications. You will not, however,
have been introduced to every class that may be useful to you in your own Web appli-
cations. For one thing, we have no way to know what your particular requirements
might be. Furthermore, we have neither the space nor the inclination to repeat
oceans of material that is already clearly explained in the .NET Framework docu-
mentation. Instead, we provide an orientation into the System. Web namespace to
enable you to find the information you need when you need it. If you plan to be a
serious developer of Web applications, we strongly recommend that you treat
yourself to regular explorations of the capabilities of the System. Web namespace as
well as the other .NET namespaces that you work with frequently.

xxi
Introduction

Downloading the Source Code


You can download the source code and images for the examples in this book from
the publisher's Web site at http: I l"vMW. apress. com. For each chapter, the ReadMe.htm
file contains instructions for installing the example code. The ReadMe.htm file also
lists the changes and corrections made to the code since the book was published.

About Smartisans.com
We invite you to visit our Web site, http: I lwww. smartisans. com, to see what we're up
to. Along with the archive of articles on Web design and usability, we intend to post
Web programming tips and tricks using Visual Basic .NET. Also, we will post
updates and corrections to this book. And, please, if you like our book and Web site,
tell your boss, co-workers, neighbors, friends, and family. For that matter, tell the
world-writing a book doesn't pay all that well, and our technical skills are for hire!

:xxii
CHAPTER 1

Meeting the Challenges


of the Web
IN THIS CHAPTER, we focus on the what and why of Web programming rather than
the how. Thus, this chapter does not contain much code (but all of the following
chapters do). Before delving into the specifics of using Visual Basic .NET to program
Web applications, we'll take a look at the bigger picture. What should we try to
accomplish with these brand new tools? What challenges do we face in achieving
our objectives? What does ASP. NET bring to the table to help us? We'll answer these
questions here.
After reading this chapter, you will be ready to tackle the specifics of how to
program the Web using Visual Basic .NET. The Web poses a unique set of challenges,
and you need to understand those challenges to address them.
We start this chapter by describing how Web programming fits into the multi-
tiered application structures that are familiar to experienced Visual Basic
programmers everywhere. Technologies introduced by ASP.NET provide addi-
tional choices when you factor an application into reusable components.
We introduce two markup languages: Hypertext Markup Language (HTML)
and Extensible Markup Language (XML). HTML is the markup language used by
all Web browsers, and XML is a subset of Standard Generalized Markup Language
(SGML) that is used to deliver data over the Web. The use of markup languages in
Web programming promotes interoperability among systems by divorcing the
exchange of information between applications from the physical details of the
operating platforms on which those applications run. ASP.NET uses XML exten-
sively, both internally and externally, and it outputs Web pages as HTML.

What Are the Challenges of Web Development?


Now that Web development tools have begun to mature, the major challenges
facing Web programmers lie in the nature of the Internet itself. In this chapter, we
discuss some of the particular challenges facing Web programmers that do not
confront developers of desktop applications. These challenges include programming
in a stateless mode and working to reduce the number of round trips between clients
and servers. Additional challenges arise because many things that affect a visitor's
Chapter 1

experience with a Web application lie outside of the programmer's experience, let
alone the programmer's control. The sheer number of combinations of computer
platforms, inconsistent browser versions, and network connections on the Internet
is immense. Couple this with the fact that each visitor can elect to disable scripting,
can refuse to accept cookies, and can adjust the sizes of the text that the browser dis-
plays, and you have-well-an exciting challenge. Let's just say that the Internet is
bigger and messier than the corporate world.
One of the keys to writing good, efficient Web applications is gaining a strong
working knowledge of the facilities that are available to you in the ASP. NET
namespaces. We simply can't stress this too much, and so we conclude this
chapter with a brief tour of the ASP. NET namespaces. The ASP.NET namespaces
provide a great number of useful, efficient classes already available to help you
achieve your objectives. And, where generalized facilities won't help, you can tap
into the vast store of available property information to help steer your programs
through the maze of potential problems. Throughout this book, we mine the
ASP.NET namespaces for their valuable resources. As you work through the following
chapters with us, we encourage you to do the same.
Despite the special challenges of Web programming, your hard -earned Visual
Basic .NET experience will give you a leg up in building Web applications using
ASP. NET. For example, you can still rely upon your working knowledge of multi-
tiered applications.
A quick reminder before we begin: If you aren't yet familiar with Visual Basic
.NET, read one of the other Apress books on Visual Basic .NET before you read this
book. The differences between Visual Basic 6 and Visual Basic .NET warrant a
complete volume, and we assume here that you have already learned how to
program using Visual Basic .NET. On the other hand, we don't assume that you
already know how to program Web applications-using ASP or any other technology.
And, even if you have done Web programming in the past, ASP. NET (that part of the
.NET Framework devoted to Internet programming) starts a whole new ballgame.
In this chapter and throughout this book, we assume that you use Visual
Studio .NET for your development work. You can write Visual Basic .NET programs
using Notepad, but for that matter you can dig the hole for a swimming pool with
a teaspoon. Because Visual Basic programmers generally prefer the language
because of the productivity advantages it affords, we doubt that any serious Visual
Basic .NET programmer intends to go the Notepad route.

Creating Multitiered Applications for the Web


Truly veteran programmers remember when personal computers did not connect
to networks at all. In those days, personal computer applications were standalone
applications by definition. When desktop computers invaded the workplace, many
organizations developed client-server applications, in which central servers held

2
Meeting the Challenges of the Web

information available to all the clients (the desktop computers) connected to the
organization's network. As technologies improved, developers created more
sophisticated applications comprising separate components that could commu-
nicate with each other over the network. Each component performed tasks that were
appropriate to the computer on which it ran. For example, components deployed
on client computers handled user interface tasks, and components deployed on
servers provided and maintained central database information.

NOTE In this book, we use tile word component in its more general sense,
rather tlzan as a synonym for COM component. However; ASP.NET Web
applications can readily employ legacy COM server components.

Today, many applications consist of three or more tiers of reusable components.


Take a look at the familiar multitiered-processing configuration depicted in Figure 1-l.
The client tier includes the computers and workstations operated by people making
use of the network. The components in the business server tier mediate commu-
nication between the clients and the database servers, applying appropriate
business rules as they do so. Components in the database tier communicate only
with business server components. This configuration promotes an equitable and
efficient sharing of database information among all the clients on the network.

Business Database
Server Server

Business Database
Server Server

Figure 1-1. The multitiered-processing configuration factors application tasks into


separate tiers of reusable components.

When you talk about Internet programming, your clients include-potentially


at least-every computer with an Internet connection. You have no say in the
hardware, software, and browsers that your visitors choose to employ. But your
applications and services reside on the servers controlled by your organization.

3
Chapter I

How does that affect your programming? To compensate for your lack of control
over the client tier, you take care to develop server components that perform
application tasks effectively regardless of the configurations used by your visitors.
Furthermore, you factor your application to allow for the redeployment of its
components to handle changes in the volume of visits. Consider the situation from
the viewpoint of the administrators of an organization's servers. Most successful
Internet applications start out with relatively light traffic that increases over time.
Once traffic approaches the capacity of the existing servers, the administrators
may add additional servers to help carry the load. They will then transfer some of
the tasks performed by the old servers to the new ones. Over time, this cycle might
be repeated many times. In fact, that's what we hope for, because it means that
we've developed a successful application. But the administrators will be able to do
their jobs effectively only if we've designed and programmed in a way that makes
this redistribution of tasks feasible. When an application or service operates effi-
ciently regardless of the amount of traffic it processes, we say that it scales well or
is scalable.
Sometimes an application acts so independently that a system administrator
can simply install it on any or all of the organization's servers. The prime example
of this is an application that reads static information from a single database and
formats it for display in the client's browser. In such cases, each incoming request
can be routed to the least-busy server by the network software.
Often, however, things aren't that simple. When customers place online orders,
for example, the underlying services cannot operate independently. What one cus-
tomer does might affect the choices available to the next customer. To create a
scalable application under these circumstances, you must break the application
into logical components that can, if necessary, be separated and executed on dif-
ferent servers. With Visual Basic 6, you do this by creating COM components and
registering them on different servers. With Visual Basic .NET, you do this by creating
and deploying assemblies using the .NET Framework. In Chapter 14, we explain
what it takes to deploy the applications you create using Visual Basic .NET. The
designers of .NET took pains to simplify this activity, as compared with the process
necessary to deploy COM components.

4
Meeting the Challenges of the Web

Whether you program for the desktop or the Web, your application's user
interface executes in the client tier. One of the major differences between desktop
applications and Web applications crops up in programming for the client tier.
Using Visual Basic .NET, you program the client tier by developing a Web form
application to interact with the Web browsers of your visitors.

Sending Text to a Web Browser


Where you would use Windows forms in a desktop application, you use Web forms
in a Web application. Instead of appearing as unique windows on a desktop however,
Web forms appear within the visitor's Web browser. The differences between the
desktop and Web programming models arise from the fact that your Web appli-
cation must communicate with its visitors by sending HTML (which we discuss
later in this chapter) to browsers rather than by executing application programs on
the client computers.
Instead of clicking an icon on the desktop, a Web site's visitor requests access
by entering the site's URL address in the browser. The browser submits the request
to the server at the URL address, and the server then passes the request to the Web
application, which analyzes the request and prepares a response. Finally, the
server returns the response to the client browser, which displays the returned
HTML. When you develop your Web application using Visual Basic .NET, each
response is either a Web form (allowing for interactivity) or a static (content -only)
HTML page. After reading the Web application's response, the visitor might send a
follow-up request to the same Web site or switch to a new Web site. If you live like
most of us these days, you are very familiar with this scenario.
The portion of the .NET Framework responsible for receiving Web requests
and returning Web responses is ASP. NET. With the release ofVisual Basic .NET and
Visual Studio .NET, Microsoft greatly simplified the development of Web appli-
cations. With Visual Basic .NET, you can now develop a Web application using
many of the same skills and techniques you would use when writing a desktop
application. To create a Web application, you bring up the Visual Studio .NET New
Project window and select the icon for the ASP.NET Web Application project tem-
plate instead of the icon for the Windows Application project template. Enter an
appropriate name for your project and then click the OK button. As shown in
Figure 1-2, Visual Studio .NET creates your project and adds a number of files to
the project directory.

5
Chapter 1

~.fCh•pter_Ol - 1.\icrosoft VJSual Basic .NET [design]- Webforml.aspx I!II!JEJ


file fdit '!:iew {'roject jluild Qebug Djta F20'flat Table ]nsert Frames Iools J!!indow l:felp
~Debug ~
»

II; Pointer References


A t..abe1 ~ Assemblytnfo.vb
r;bl TextBox
tl Chopter_01.1/Sdiscc
!!!I Button
eli) Global asax
.MJ Unld!utton
~ Styl4s.css
lid lm~ieButton
: The pac~ ~~~ "a;~ ~~kin& on~ ·i~ &rid lAyout ~~d~; J.nd :: ::::: : Web. con
A Hyperllnk . : : ·: objects will be arronged usllllabsow te (x and yj: : : : : :: :::
• OropOownUst :coordmates. : : : ·
UstBox
4J DaaGrld To use flow layout Itop to bottom, asln • word orocessllll : : : : : :
DataUst • • · document), change the Pitielayout property of the: : : . : : : : :
!!!! Repeater · : . : •~cu~.n: !D. AowL~y~~t.. :

How the fle related to the


buRd and deployment pr ...
~~ Ia DeSI!Jl I .. HIM. PrO!?% ties Io Dynamic ..• I
Ready r
Figure 1-2. The Visual Studio .NET designer allows you to create Web applications in the
same manner as you create Windows applications.

Beginning with Chapter 2, we delve into the details of creating well-written


Web applications using Visual Basic .NET. Our objective for this first project is very
limited. Here we demonstrate how the designer and the browser interact when
you develop a Web application in Visual Studio .NET. Figure 1-3 shows the design
view of the Web page we wish to send to the browser.

6
Meeting the Challenges of the Web

•.Chapter_01 MICrosoft Vtsual Basic .un (design) Webforml.•sp< 11!1~£1

:t~ froject Build l!ebug Data FllflNt Table Jnsert Frames Iools :tllndow ttelP
.., • C'• • • Debug ~
»

u .f.
Soluuon hplorer . C. .. l X

Hello world!

Figure 1-3. This simple Web page design will display "Hello world!" in the browser.

As with a Windows desktop application, you can initiate debugging by choosing


Debug> Start. After performing any required compilation, Visual Studio .NET
passes the URL of the project to Internet Explorer. Internet Explorer then sends a
request to the Web application and awaits the response. Figure l-4 shows Internet
Explorer after it has displayed the response.
As it stands, the simple Web application in this example does nothing but
display static text. The visitor has no way to change the output in the browser
except by entering a different URL in the browser's address box. In most cases,
however, the Web pages you create will contain buttons and links that allow the
visitor to direct the flow of the application. Web applications with a browser
interface are called Web form applications or, simply, Web forms.

7
Chapter 1

Hello world!

Local Intranet

Figure 1-4. The Internet Explorer browser window displays the "Hello world!" response.

Providing XML Web Services


Traditionally, Web applications were limited to sending HTML for display in Web
browsers. If you developed another application that needed to use a small amount
of information from a Web site, you wrote a "screen scraper" program that located
the desired information within the Web site's HTML. When the developers of that
Web site changed their HTML, you changed your screen scraper accordingly. You
can imagine the horrors arising from this approach. With the advent of ASP. NET,
XML Web services allow applications to exchange information over the Web in a
consistent, reliable manner.
The problems with this approach result in large part because screen scraping
extracts information from the user interface of an application rather than from a
proper business-logic component of the application. A well-designed application
depends upon an effective division of application tasks into components. Although
you cannot create a COM component with Visual Basic .NET, you can develop a
.NET component wherever you would previously have developed a COM component.

8
Meeting the Challenges of the Web

You can also use your existing COM components with .NET applications. Your
Web form applications can and should make use of well-designed components
that encapsulate the business rules of your company or organization.
With the release of ASP.NET, we have a new type of component (in the generic
sense of the word) to throw into the mix. XML Web services make application-to-
application communication feasible over the Internet. Because all information that
passes to and from XML Web services is in the form of text -only XML documents (if
you aren't familiar with XML, don't worry-see the next section of this chapter), appli-
cations running on platforms other than Windows can make use ofXML Web services.
Even applications running behind firewalls can make use ofXML Web services.
The great flexibility offered by this new type of component should earn it
consideration when you decide how to partition the tasks performed within a
new application. Chapter 8 of this book is devoted to the development of XML
Web services.

Using HTML and XML


One of the productivity-boosting features of Visual Basic has always been the
immediate feedback returned by its interpreter during programming and testing.
Although Visual Studio .NET does a good job of simulating that environment in
the development of Web applications, there is no getting around the fact that the
output of your Web form applications consists ofHTML. Similarly, your XML Web
services output XML. As a Web programmer, you face the challenge of acquiring at
least a reading knowledge of both languages.
If you already know HTML and XML, you can skip this section. We present this
information to assist Visual Basic programmers who haven't yet had to deal directly
with these markup languages. As their name implies, markup languages mark up
text flies with special syntactical elements that describe specific portions of the
text. The markup elements are not part of the text itself, but rather provide addi-
tional information about the text. This information can be useful to both humans
and computer programs when reading or processing the text. Consider the following
HTML snippet:

<b>Display this as bold text.</b>

The actual text in this example is "Display this as bold text." The <b> and <lb>
markup tells a browser to use a bold font to display the enclosed text. The browser
does not display the markup directly, but uses it to format the text enclosed within
the markup elements.
XML uses markup not for formatting but for describing textual content. Look
at this XML example:

9
Chapter 1

<city>New York< / city>

The markup in this example identifies the enclosed text as a city. Without the markup,
the text could refer to either the city or the state of New York. As a human reader,
you might be able to discern the meaning from the context, but marking up the
text in this way removes any potential ambiguities for both human readers and
computer programs.
As we mentioned earlier, Web form applications communicate with visitors by
sending HTML to client browsers. XML Web services communicate with other
applications by exchanging XML documents. XML is also used extensively within
the .NET Framework, in configuration files for example. HTML and XML share
(more or less) the same syntax, so, if you know one of them, reading the other is easy.
Let us say first that you do not have to become an expert in either HTML or
XML to develop ASP. NET applications. Second, the basics of each are quite simple,
so you won't find reading HTML or XML to be a stumbling block. Once you find
yourself writing a bit ofHTML or XML (yes, it will happen!), the IntelliSense feature
in Visual Studio .NET will come to your rescue. Soon you will feel like an old hand,
particularly at HTML.
We do not mean to suggest that you will immediately find complex HTML and
XML documents easy to read or to create from scratch. Far from it. But, when you
develop a Web application, the HTML you write (or cause to be generated) maps
directly into the controls and formatting elements that appear in the Visual Studio
.NET designer. The concrete relationship between the HTML and its visual repre-
sentation in the designer makes it easy to connect the two mentally. Similarly, the
XlVfL you write (or cause to be generated) maps directly into the data for your
project, or into some other concrete portion of your application. Again, this makes
it easy to make the mental connections.
True, the automated support for writing both HTML and XML in Visual Studio
.NET makes it possible for you to create Web applications without writing any
HTML or XML whatsoever. But, although you will usually find it convenient to let
Visual Studio .NET generate your XML, we predict that you will soon find yourself
quite comfortable working directly in the HTML window while creating your
Web pages.

NOTE In a way, the rapid feedback you get by switching between the Design
and HTML windows in Visual tudio .NET resembles the rapid feedback
fJrOIIided by tl1e interpreter for older uersions of Visual Basic. This kind of
immediate and concrete feedback boosts t11e learning rate for most people, and
doe so quite painles ly.

10
Meeting the Challenges of the Web

Writing Well-Formed HTML and XML


Generally speaking, HTML and XML share the same syntax. Some differences arise
because XML must be well formed, whereas HTML parsers make some educated
guesses about what the HTML writer really intended. Because XML parsers don't
contain code to make such guesses, they tend to be more compact and more efficient
than HTML parsers. And, because different HTML parser development teams
sometimes make slightly different guesses about what the writer really intended
(among other things), HTML parsers tend to be inconsistent with each other.
Regardless of what the HTML parsers will accept, your goal should be to write
well-formed HTML, as explained in the following sections. To increase the robustness
and the usefulness of the Web, the latest standards specify well-formed HTML,
and HTML parsers will someday start requiring it. Make sure that the Web appli-
cations you write won't require retrofitting when that day arrives.

NOTE We regret to say that-at the time of this writing-Visual Stlldio .NET
does not generate well-formed HTML in all cases. Fortunately, because oftlze
forgiving nature ofcurrent browsers, the HTMLgenerated by Visual Sntdio .NET
does not create Web application problems at this time.

The syntactical elements that we cover here describe the vast majority of the
HTML and XML that you will encounter. In this book, we explain the few oddball
cases when they arise in programming examples. For your reference, the appen-
dices contain additional information about both HTML and XML.

Enclosing HTML and XML Text Within Tags


The information conveyed by markup languages is always text-based and therefore
readable by both people and machines. Separate elements of the information are
enclosed within tags. In other words, you have a text document that is annotated,
or marked up. The following line is typical HTML:

<p>This is an HTML paragraph.</p>

The <p> in this example is the start tag for an HTML paragraph element, and the </p> is
the end tag. The text between these tags constitutes a single paragraph. The slash
identifies the latter tag as an end tag, and the name following the slash identifies
the matching start tag. We recommend that you verify that the names in the start

11
Chapter 1

and end tags match exactly, including case, to make sure that the tags are well
formed. In XML, the characters in a tag name can be any case, so long as the names
in both tags match exactly. In HTML, the latest standard (dubbed "XHTML")
requires lowercase tag names.
Elements can be (and usually are) nested, and often they are deeply nested.
Look at this example of nesting, this time in XML:

<Address>
<Street>7767 Guinevere Way</Street>
<City>Atlanta</City>
<State>Georgia</State>
<Zip>30345</Zip>
<Country></Country>
</Address>

The address element in this XML example encompasses five nested elements. The
start and end tags clearly reveal the structure of the data. Although most elements
enclose content, they aren't required to do so. The Country element in this example
is perfectly acceptable. For either HTML or XML to be well formed, each child element
must be completely contained within its parent. That is, tags must not overlap.
We told you this was easy! Let's expand our horizons a bit.

Using Attributes Within Tags

In addition to enclosing content within a pair of tags, a markup language provides


a way to convey additional information about that content. Start tags can contain
attributes that convey such information. Let's look at another HTML example:

<p id="preamble">
In times like these, the need for improvement has never been more clear.
Let us consider the ways in which improvements might be made.
<lp>

This HTML paragraph is not just any old paragraph. It is the particular paragraph
with an id attribute of "preamble". We give this example because, to program
against any HTML element using Visual Basic .NET, that HTML element must have
a unique ID attribute. When you think about it, the requirement makes sense.
Take another look at the preamble paragraph. Unlike the earlier examples, the
text content of the preamble paragraph is not jammed right up against the tags.
That does not matter-all of the so-called whitespace before and after the content
is condensed into a single space when it is displayed in a browser.

12
Meeting the Challenges of the Web

Now we can introduce the next wrinkle. It is possible for an element to have
only attributes and no content. Check out the following HTML:

<input name="Textl" id="Textl" type="text" I>

This HTML element defines a text box used to capture data entered by the visitor.
Because this element never encloses content, the element does not need the nor-
mal end tag, and browsers today do not require one. Instead, the ending slash can
(and should!) appear just before the closing angle bracket. Such elements are called
empty tags or leaf nodes. Empty HTML tags, including the <br I> (line break) tag,
should contain a space before the slash to ensure correct parsing by older browsers.

Including Special Characters Within Text


Because of their use in the syntax of markup languages, you depict certain char-
acters in a roundabout way when you need them in the natural sense. You insert
one of these characters by inserting an entity reference as shown in Table 1-1. When
text containing an entity reference is displayed, the correct character replaces the
entity reference.

Table 1-1. Entity References for Special Characters

Symbol Entity Reference


Ampersand(&) &amp;
Apostrophe or single quote (') &a pas;

Double quote (") &quot;


Greater than (>) &gt;
Less than (<) &lt;
Unicode character &#decimalNumber; or &#xhexadecimalNumber;

To ensure correct parsing, text cannot contain single or double quotation


marks within quotes of the same type. To avoid this problem, you can substitute
entity references. Alternatively, you can substitute the other type of quotation
mark for one of the pairs, as in the following example:

<INPUT id="txtquote" type="text" value='"Nevermore!"' I>

13
Chapter 1

Note that the value attribute is enclosed in single quotes. This substitution avoids
the conflict that would otherwise arise because of the double quotes to be displayed
in the HTML text box.
Sometimes you want to insert a space in an HTML document that will
not be condensed into the whitespace. In such cases, use the nonbreaking
space reference: &nbsp;.

Building HTML Documents


Each page in a Web site comprises a complete HTML document. In HTML, tag
names describe both the structure and format of the document. HTML tags
enclose the entire document, which contains a head section and a body section.
The head section contains information about the document, and the body section
contains the contents of the document, as in the following skeletal example:

<html>
<head>
<title>HTML Sample</title>
</head>
<body>
<p>
This is a paragraph in an HTML document.
<lp>
</body>
</html>

Because current browsers accept HTML that is not well formed, you will definitely
encounter HTML that doesn't adhere to the syntax rules spelled out here. The most
common offenders are empty elements with no end tags.
When you develop Web form applications, you will often want to look at the
HTML that's actually received by the browser from your application. You can view
the HTML from Internet Explorer by choosing View~ Source. Figure 1-5 shows the
HTML sent to the browser from our Hello World application. Note that Visual
Studio .NET itself did not generate well-formed HTML when it created the META
tags. (Don't tell anybody, but, while visiting a Web site that looks remarkable in one
way or another, we often peek at its HTML.)
In Chapter 4, we describe the most common HTML tags in connection with
their use as HTML controls. Appendix B of this book is a quick reference that con-
tains more information about the structure and use ofHTML.

14
Meeting the Challenges of the Web

~ Webform1[1) Notepad 1!1~£1


Ffle Edit Format View Help

<!OOCTYP£ HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional /f EN">


<ht:ml>
<head>
<t:it:le>Hello world!</ t:it:le>
<met:a name-"GENERATOR" cont:ent:•"Microsoft: visual st:udio. NET 7. 0">
<met:a name•"COOE_LAHGUAG£" cont:ent~"visual Basic 7.0">
<meta name="vs default:client:script " content:• "Javascript">
<meta name-"vs::t:arget:Schema" cont:ent-"htt:p: //schemas . microsoft:. COIII/i nt:ell isense/ i e5">
<bhead>
< ~orm name•"Forml." me'thod•"post " anion-"webForml.aspx" id•"Forml">
input: t:ype•"hidden" name="_vu:wSTATE" value-"dOWt:MTI30TMZNOM4NDs7Pg-" />
<hl>
Hello world !
</hl>
</forlfr>
</body>
</h'tmh

Figure 1-5. The browser spills the beans about the HTML it is displaying.

Using XML Documents in Web Applications


One of the major goals of the .NET Framework is to remove impediments to
interoperability. Binary interfaces between components, systems, and networks
create many of the obstacles that must be overcome before true interoperability
can be achieved. For any new application to make use of a binary interface, the
programmers of the new application must have a thorough technical understanding
of that interface. If the new application will run on a different platform, platform
differences will compound the difficulties in programming to the binary interface.
Reordering the bytes in numerical data might even be necessary should the new
application run on, say, a "big en dian" computer when the interface was designed
for "little endian" computers, such as those with Intel CPUs.
To permit interoperability among systems that run on different platforms, the
.NET Framework makes pervasive use ofXML to describe both data and the
external interfaces of software components. The use ofXML rather than binary

15
Chapter 1

interfaces provides the data source independence that is needed for true interop-
erability. As shown in the example in Figure 1-6, an XML document can be read by
both humans and computers and has a striking resemblance to HTML. However,
an XML document describes the content of the information within it, rather than
the format for its display. All XML documents must be well formed.

<?xmJ ve rsion=•t.o• ?>


- <Albums xmlns='http: //te mpuri.org/ Album s.xsd" Count='2">
- <Album Medrum="CD" Labei='Columbi11" Year='1992">
<1-· -an:s ·land t>;; ,;.....,~ H:Murt 1 - - >
<AibumTotle>Cilndyland </AlbumTotle>
<Performer>Jilme5 Mc:Murtry </Performer>
<Producer>lohn M II na~mp a Michael Wanchic</Producer>
- <Sefec toon Number ='1 • >
<Totle>Wh re's Johnny </Totle>
<Monutes >4 </Monute s>
<Seconds 2 </Seconds>
<Composer>Jame,;; Mc:Murtry </Composer>
- <Artist>
<Name >Kenny Arilnoff</Name>
<lnstrument >Drum,;; </Instrument >
<Instrument >P rcu slon </l nstrument>
</Artist >
+ <ArtiSt>
+ <Artist>
+ <Artist>
+ <ArMt>
+ <Artist>
</Selection>
- <Selection Number='2">
<Totle>Vague Dlrections </Totle>

Figure 1-6. Each pair of XML tags in an XML document describes the information
contained between the tags.

The screenshot in Figure 1-6 shows the top portion of an XML document
displayed in Internet Explorer with no additional formatting applied. Note that
Internet Explorer marks the start tag of each nested element with a minus sign(-)
or plus sign (+) to collapse or expand its display.
Every XML document.contains two sections: the pro log and the content. The
first section is the prolog, which, at a minimum, identifies the document as being
an XML document. The XML declaration in Figure 1-6 is the entire prolog:

c?xml version="l.O"?>

16
Meeting the Challenges of the Web

Other prolog lines may be present in XML documents, but the XML declaration
containing the version number attribute is the only line that's required. The prolog
of an XML document ends when the content portion of the document begins. The
content portion consists of elements delimited by start tags and end tags. We call
the first element in the document the root element. The root element in Figure 1-6
is the Albums element. The content portion of the example XML document begins
with the Albums start tag, as shown here:

<Albums Count="2">

Just as you find it useful to include comments in your Visual Basic code, you'll
sometimes see comments in XML and HTML documents. The fourth line in Figure
1-6 shows the format of a comment statement:

<!--Candyland by James McMurtry-->

Comments begin with<!-- and end with-->. Comments cannot appear anywhere
within tags, but, aside from that limitation, XML allows a great deal of flexibility in
using them. You can put comments in the prolog, after the XML document, or
within the textual portions of the document. The only restriction placed upon the
text within a comment is the understandable prohibition on the use of--> within
a comment. Therefore, you can comment out portions of an XML document that
you are testing in much the same way as you can comment out portions of your
Visual Basic code.
The entire content of the example document is enclosed within the Albums
start tag and the associated end tag. The actual end tag (not shown in Figure 1-6),
the last line of the document, looks like this:

</Albums>

Because the root element actually defines the overall document, it is also known as
the document element. The elements nested within the root element flesh out the
details of the document content. For more information about XML, see Appendix C.

Programming in the Internet Environment


Many of the biggest challenges you will face as a Web programmer arise from the
nature of the Internet itself. The immense size of the Internet, together with the great
variety of software and hardware connected to it, creates a difficult programming
environment.
In the early days of programming, limited hardware resources forced pro-
grammers to devote much time to optimizing routines to reduce size and increase

17
Chapter I

speed. Over time, the costs of computer hardware dropped greatly, and spending
valuable programmer time to squeeze out the last drop of performance could not
be justified. Few managers questioned spending money to reduce online response
time from ten seconds to one second, but almost every manager questioned
spending money to reduce response time from 1/10 of a second to 1/100 of a
second. In Web programming, however, response time has again become a major
consideration. So has the efficient use of network and computer resources. These
factors influence both the design and the implementation of Web applications.
Every Web session comprises a series of round trips between the client and
server. As Figure 1-7 illustrates, the first round trip in the session starts when the
visitor requests a particular URL from his or her browser. The first round trip ends
when the requested Web page appears in the client's browser. Once the session has
been established, each subsequent round trip begins with an action at the client
that (typically) requests information from, or provides information to, the server.
The server processes the request or information, and then it responds to the client.

URL

HTML Page

1.

Link
Another HTML Page

2.

Text In ut

Updated HTML Page

3.

Figure 1-7. When using the Web, each round trip begins with an action at the client
and ends with a response from the server.

18
Meeting the Challenges of the Web

When you develop a Web application, your code runs on the server-but the
visitor occupies the driver's seat. The visitor controls the length of the application
session and the sequence of pages displayed within the session. He or she can
abandon the session at any time, leaving it up to ASP.NET to conclude the session
after the time-out interval elapses. The Web application, on the other hand, treats
each request as an independent unit, forgetting everything about the requests that
have come before. This intentional forgetfulness constitutes stateless execution, a
technique that conserves server resources and improves scalability. If the client
abandons the session, no application resources are tied up waiting futilely for the
next client action.
Let us hasten to add, however, that stateless execution does not mean that
your Web application lacks the means to find its place in a back-and-forth exchange
with the client. Indeed, ASP. NET knows about your application and about your
session with the client. It uses very efficient techniques for keeping track of the
traffic on the server and for storing the small amount of information that is needed
to maintain continuity within sessions. By making use of the facilities provided by
ASP.NET, you can write scalable Web applications that do not appear in the least
forgetful to the visitors. One of the sections in Chapter 2 describes the ASP. NET
facilities you can use to store state information efficiently even though your Web
form instance is destroyed after sending a response to the visitor.

Facilitating Stateless Execution


To write an application or service that scales well, you need to make wise use of
your organization's network and server resources. That's where stateless execution
comes in: you don't want to bog down your servers with information about the
current state of your clients. Rather, each time a request comes to your server from
a client, your application must process it completely, reply to the client, and end
execution. In practice, you won't always be able to achieve this totally, but you
need to be quite ruthless about returning the resources that your program uses as
soon as possible. After all, you have no guarantee that the client will ever make the
next request that your program expects to receive, so any state information retained
on the server might turn out to be pointless as well as wasteful.
ASP. NET actually works behind the scenes to make simpler Web forms stateless
with no effort on your part. We can demonstrate this with another little example. If
you have downloaded the sample code for this book, you can try it out for yourself.
(The project to load is Chapter_Ol.) Figure 1-8 shows the browser display before
the visitor enters any data in the textbox.
In addition to the textbox at the top, the Web page contains two buttons (Reset
and Submit) and two labels underneath the buttons, as shown in Figure 1-8. The
entire Visual Basic .NET code for this Web page is presented in Listing 1-l.

19
Chapter 1

cniginal top label text


Original bottom label text

Done Locallntr~et

Figure 1-8. The initial presentation contains text that marks the positions of the two
labels on the Web page.

Listing 1-1. The Chapter_01 PostBack Example Web Application

Public Class WebForml


Inherits System.Web.UI.Page
Protected WithEvents txtlnput As System.Web.UI.HtmlControls.HtmlinputText
Protected WithEvents lblTop As System.Web .UI.HtmlControls.HtmlGenericControl
Protected WithEvents lblBtm As System.Web.UI.HtmlControls.HtmlGenericControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.


<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()

End Sub

20
Meeting the Challenges of the Web

Private Sub Page_Init(ByVal sender As System.Object, _


ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, _


ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Me.Page.IsPostBack Then
Me.lblTop.InnerHtml = "Original top label text"
Me.lblBtm.InnerHtml = "Original bottom label text"
Else
Me.lblBtm.InnerHtml = Me.lblTop.InnerHtml
Me.lblTop.InnerHtml = Me.txtlnput.Value
End If
Me.txtlnput.Value = String.Empty
End Sub

End Class

We have used traditional-looking Visual Basic names for the controls on the Web
form: txtinput for the textbox used to accept visitor input, lbl Top for the first label
underneath the buttons, and lblBtm for the second label under the buttons. You
may have noticed, however, that Listing 1-1 makes no reference to the two buttons
whatsoever. As you will soon see, we have no need to reference either button in
this project.
First, however, let's step through what happened in the code when the visitor
first requested the Web form. (In this case, of course, we simulated that request by
starting the application from Visual Studio .NET.) The first time the visitor brings
up the Web form, the IsPostBack property is False. This gives you a chance to
perform any initial processing that your Web form requires. On subsequent Load
events, ASP.NET sets the IsPostBack property to true. In Listing 1-1, therefore, the
following statements execute during the initial load:

Me.lblTop.InnerHtml = "Original top label text"


Me.lblBtm.InnerHtml = "Original bottom label text"

21
Chapter 1

and then:

Me .txt input.Value = String.Empty

We discuss the InnerHtml and Value properties in Chapter 4. As you can see from
Figure 1-8, however, these statements initialize the Web form.
If you are following along with this on your own computer, enter some text in
the textbox at the top of the page. Now click the Reset button and watch the text
disappear. (If you are not following along on your computer, you'll have to take our
word for this.) What has happened is that the browser itself understands the
function of an HTML Reset button and has restored the contents of the textbox to
its original value-which, in this case, is an empty string. Now enter some more
data, as we have done in Figure 1-9.

jVisual Baste NEll

Reset 1 I Subm~ I
Original top label text

Original bottom label text

Done Local Intranet

Figure 1-9. The visitor has entered "Visual Basic .NET" into the textbox in preparation
for clicking the Submit button.

22
Meeting the Challenges of the Web

This time, click the Submit button. The browser recognizes this as a signal that
the visitor is ready to post back some data to the server. Now, when the Web form's
Load event fires, the IsPostBack property is true. Therefore the following statements
execute:

Me.lblBtm.InnerHtml = Me.lblTop . InnerHtml


Me.lblTop.InnerHtml = Me.txtlnput.Value

and then:

Me .txtlnput .Value = String.Empty

The text of the top label is moved to the bottom label, and the text entered by the
visitor is moved to the top label. That finishes our processing at the server, so
ASP. NET sends the updated form back to the client, completing the second round
trip in the session. Figure 1-l 0 reveals that the Web form now displays exactly
those changes.

Reset J . Submit ]

Visual Basic .NET

Original top label text

LocallntrOillet

Figure 1-10. The text entered by the visitor has moved to the top label, and the
original text from the top label has moved down a notch.
23
Chapter 1

Remember how clicking the Reset button earlier erased the text you entered at
the browser? Now you can tell that the Reset command did not trigger a postback
to the server. If it had, the code in the Page_ Load event handler would have moved
the text you entered into the top label.
But wait a minute! What about stateless execution? If the second round trip
built the Web form again from scratch, where did the text in the top label come from
to be moved to the bottom label? How could the following statement work at all?

Me.lblBtm.InnerHtml = Me.lblTop.InnerHtml

The answer is that ASP. NET worked behind the scenes to restore the text of the
labels before it fired the Load event. And where did ASP. NET get those values? From
a hidden field in the HTML that was returned with the new request from the client.
ASP. NET put the hidden field into the HTML just before it sent the HTML to the
client in response to the original request. If you look at Figure 1-11, you'll see the
following code in the source HTML at the browser:

<input type="hidden" name="_VIEWSTATE" value="dDwtMj ... [omitted] ... 47Pg==" I>

By default, ASP.NET avoids the need to save state information at the server by
transmitting that information in an encoded form to the client for storage there.
Before firing the Load event after a postback, ASP.NET restores the original values of
the fields that were not changed at the client. Needless to say, using network
resources in this way is not always the right way to go, and we reexamine this topic
in Chapter 2.
It would certainly be better if you could use your desktop techniques in Web
applications. In Chapter 6, as a matter of fact, we do show how to perform simple
client-side validation checks using JavaScript. (Don't worry-ASP.NET supplies the
script.) Realistically, however, many validation checks require information held by
servers. Someday, perhaps, you'll be free of the constraints that force you to con-
sider factors other than the visitor's experience when you develop Web applications.
For now, though, you must program to minimize the impact of the Internet's
limitations upon your visitors.

24
Meeting the Challenges of the Web

C PostB.ck[T] Notepad 18911!1


File Edit Fonnat View Help

<!OOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transi~ional//EN">


<h~ml>
<head>
~itle>PostBack Demonstration</~i~le>
<me~ a name-"GENERATOR"" coment•"Microsoft visual studio. NET 7. 0">
<meta name•""CODEJ.AHGUAGE"" con~ent•"'visual Basic 7.0">
<Jileta name-"vs_defaultcliemscript" coment-"Javascri pt">
<meta name•"vs_targetschea>a" content•"ht~p://schemas.m1crosof~.com/1mellisense/ieS">
</head>
~~:!r name•"Forml" method•"pon" act1on-"Posuack. aspx" id•"Forml">
<input ~ype-" h1dden" nam_"_VIEWSTATE"
value="dDwtMjEZNjYZMTE2Mzt0PDtSPGk8MT47PjtsPHQ802w8aTWzPjtpPDU+OZ47bDX0PHA8bDxpbm5lcmhObWW7PjtsP
FZpC3VhbcBCYXNp~AUTkVUOZ4+0ZS+03Q8CDXSPGlubmvyaHRtbos+02w8T3JpZ21uYWWgdG9WIGXhYmvsiHRleHQ7Pj470
z47Pj47Pj47Pg-" />
<input name-"~xt:Input" id · "~xunput" ~yp-"tex~" />
<P> <input ~ype-"rese~" value-"Reset">.!onbsp;
<input ~ype="submit" value- "submh">
</p>
<div id•"lblTop">Visual Basic .NET</ diV>
<p></p>
<div id•"lblB~m">Original top label ~ext</d1V>
</for-.o-
</body>
</htmh

Figure 1-11 . ASP.NET uses a hidden field named_VIEWSTATE to hold state


information about the controls in a Web form.

Reducing Traffic
When you program a desktop application, you often give your user instant feedback.
If he or she makes an invalid entry in a form field, for example, you immediately
display any information that the user needs to correct that entry. Doing so allows
the user to make the correction before he or she starts a new train of thought. From
a good, object -oriented programming perspective, the property receiving the
value makes the determination whether or not that value adheres to the validation
rules for the property.

25
Chapter 1

If you've made online purchases, you know from personal experience that
most Internet applications work differently. On the Web, you fill out a form requiring
your name, address, credit card information, phone number, and email address
before you click on the button to submit your information. After checking your
entries in one little batch, the Web application lets you know about any errors you
may have made or, if you've entered everything right, sends you a positive confir-
mation. This technique reduces the number of round trips needed between the
client and server, which is an important goal in Internet programming. Because of
the overhead required to route and validate messages exchanged between computers,
each round trip (ideally) carries a substantial amount of information. Not only
does this technique make efficient use of network resources, it also improves the
visitor's overall experience with the application-at least when compared with ini-
tiating a round trip to the server after each field entry.

Coping with Different Browsers


If everyone agreed with your personal browser choice, the world would be a better
place. Unfortunately, there's no accounting for taste, and so chaos reigns. Good
Internet programmers allow for the fact that the browsers of a great many clients
lack the capabilities of the latest releases of Netscape Navigator and Internet
Explorer. Many practical Internet programmers have addressed this situation by
offering two versions of their Web pages, with one version containing dynamic
content and the other catering to down-level browsers. Besides allowing for all
browser possibilities, good Internet programmers ensure that their applications
will not fail just because the client has disabled JavaScript execution or has invoked
some of the accessibility options.
If you program for an organizational intranet rather than for the whole Internet,
you'll most likely be able to rely upon more up-to-date versions of the popular
browsers being installed in all of your clients. Some organizations simplify matters
further by insisting that everyone use the same browser (either Internet Explorer
or Netscape Navigator). Even if you are fortunate enough to be in that situation,
however, you incur some risks when you rely heavily upon the unique features of a
particular browser. For one thing, the leadership of your organization might
change, and the new leadership might anoint a different browser. Or your organi-
zation might merge with another that has a different policy. Or the leadership
might decide that it would be beneficial to make some or all of its online infor-
mation available to the general public via the Internet.
As you'll see in Chapter 5, ASP. NET is helping to address the problem of sup-
porting different browser levels by providing a set of controls not tied directly to
HTML elements. ASP. NET may eventually be able to generate the particular HTML

26
Other documents randomly have
different content
through hatred, and in order that he whom he attempted to accuse
might suffer death, or bodily injury, or the loss of his property; he
shall be delivered over into the power of him he accused, that he
may himself suffer the penalty which he endeavored to inflict upon
an innocent person.
Where anyone states that he is in the possession of any fact
which should be brought to the notice of the king, and should be, at
the time, in the place where the court was sojourning, he shall
straightway reveal all that he knows, or shall communicate it to the
ears of the king through the agency of some reliable person. If,
however, at the time, the king should be at a distance, and the said
party should believe that information in his possession relating to the
accusation of another, ought to be sent to the king by the hands of a
messenger, he must draw up a letter, and in it set forth plainly what
he wishes to say concerning the alleged guilt of the accused; and he
must do this in the presence of him whom he has selected to convey
the information to the king. And, in order that he may not be able to
deny the aforesaid communication, three witnesses, known to be
men of respectable character, must, in the presence of one another,
affix their seals or signatures to said letter.
FLAVIUS CHINTASVINTUS KING.
VI. How Kings should Practice the Duties of Mercy.
Whenever a supplication is made to us on behalf of those who
have been implicated in any crime against our majesty, we willingly
give attention to such appeals, and exercise the prerogative of mercy
when it is consistent with our power. We must, however, refuse to
interfere when a crime of this kind has been committed against the
nation and our country. Yet, if a prince should desire to be merciful to
persons of such wicked character, he shall have the right to do so,
with the approval of the ecclesiastics and the principal officers of the
court.

VII. He Alone shall be Considered Guilty who Committed the


Crime.
Punishment for all crimes shall be visited upon the authors of the
same; and a father shall suffer no penalty on account of his son; nor
a son on account of his father; nor a wife on account of her husband;
nor a husband on account of his wife; nor a brother on account of his
brother; nor one neighbor on account of another; nor any person on
account of a relative; but he alone shall be adjudged to be guilty who
is responsible for the offence, and the crime shall die with him who
committed it. Neither successors nor heirs shall, under any
circumstances, be placed in jeopardy on account of the acts of their
parents.
TITLE II. CONCERNING MALEFACTORS AND THEIR ADVISERS, AND
POISONERS.

I. Where a Freeborn Man Consults with a Soothsayer Concerning the


Health, or the Death of Another.
II. Concerning Poisoners.
III. Concerning Malefactors and their Advisers.
IV. Concerning Those who are Guilty of Acts of Witchcraft, or any Injury,
towards Men, Animals, or any kind of Property whatsoever.

FLAVIUS CHINTASVINTUS, KING.


I. Where a Freeborn Man Consults with a Soothsayer
Concerning the Health, or the Death of Another.
Whoever plots the death of the king or any of his subjects, and,
with a view to the execution of such a crime, consults diviners,
augurs, or soothsayers; should he be freeborn, he shall be scourged,
and be condemned to perpetual slavery in the public service, after
the confiscation of all his property, or he shall be delivered up as a
slave to anyone whom the king may select; and those who have
given him advice shall undergo the same penalty. And if any children
should be implicated in the crime of their parents, they shall be
punished in like manner. But if said children should be innocent, they
shall not be degraded in rank, and shall enjoy full and undisturbed
possession of all the property which their parents have lost. Slaves
who are implicated in such offences shall be tortured in various
ways, sold, and transported beyond sea; as the vengeance of the
law does not excuse those who have voluntarily participated in such
infamous proceedings.
FLAVIUS CHINTASVINTUS, KING.
II. Concerning Poisoners.
Different kinds of crimes should be punished in different ways;
and, in the first place, freemen or slaves who are guilty of preparing,
or administering poison shall be punished in like manner; as for
instance, if they should give poisoned drink to anyone and he should
die in consequence; in such a case those who are guilty shall be put
continuously to the torture, and be punished by the most ignominious
of deaths. But if he who drank the poison should escape with his life,
the party who administered it shall be given up into his power, to be
disposed of absolutely as he may desire.
FLAVIUS CHINTASVINTUS, KING.
III. Concerning Malefactors and their Advisers.
Enchanters, and invokers of tempests, who, by their incantations,
bring hail-storms upon vineyards and fields of grain; or those who
disturb the minds of men by the invocation of demons, or celebrate
nocturnal sacrifices to devils, summoning them to their presence by
infamous rites; all such persons detected, or found guilty of such
offences by any judge, agent, or superintendent of the locality where
these acts were committed, shall be publicly scourged with two
hundred lashes; shall be scalped; and shall be dragged by force
through ten villages of the neighborhood, as a warning to others.
And the judge, lest, hereafter, the aforesaid persons may again
indulge in such practices, shall place them in confinement, and see
that they are provided with clothing and food, to deprive them of an
opportunity of inflicting further injury; or he may lay the matter before
the king, to be disposed of at his royal pleasure. Those who are
convicted of having given advice to such persons, shall each receive
two hundred lashes in the assembly of the people, in order that all
who have aided in the commission of such a crime may not go
unpunished.
FLAVIUS CHINTASVINTUS, KING.
IV. Concerning Those who are Guilty of Acts of Witchcraft, or
any Injury towards Men, Animals, or any kind of Property
whatsoever.
We decree, by the present law, that if any freeman or slave, of
either sex, should attempt to employ, or should employ, witchcraft,
charms, or incantations of any kind with intent to strike dumb, maim,
or kill, either men or animals; or injure anything movable; or should
practice said arts to the detriment of crops, vineyards, or trees; he
shall suffer in person and property the same damage he endeavored
to inflict upon others.[34]
TITLE III. CONCERNING ABORTION.

I. Concerning Those who Administer Drugs for the Production of Abortion.


II. Where a Freeborn Man Causes a Freeborn Woman to Abort.
III. Where a Freeborn Woman Causes another Freeborn Woman to Abort.
IV. Where a Freeborn Man Produces Abortion upon a Slave.
V. Where a Slave Produces Abortion upon a Freeborn Woman.
VI. Where a Slave Produces Abortion upon a Female Slave.
VII. Concerning Those who Kill their Children before, or after, they are Born.

ANCIENT LAW.
I. Concerning Those who Administer Drugs for the
Production of Abortion.
If anyone should administer a potion to a pregnant woman to
produce abortion, and the child should die in consequence, the
woman who took such a potion, if she is a slave, shall receive two
hundred lashes, and if she is freeborn, she shall lose her rank, and
shall be given as a slave to whomever we may select.
ANCIENT LAW.
II. Where a Freeborn Man Causes a Freeborn Woman to
Abort.
If anyone should cause a freeborn woman to abort by a blow, or
by any other means, and she should die from the injury, he shall be
punished for homicide. But if only an abortion should be produced in
consequence, and the woman should be in no wise injured; where a
freeman is known to have committed this act upon a freewoman, and
the child should be fully formed, he shall pay two hundred solidi;
otherwise, he shall pay a hundred solidi, by way of satisfaction.
ANCIENT LAW.
III. Where a Freeborn Woman Causes another Freeborn
Woman to Abort.
Where a freeborn woman, either by violence or by any other
means, causes another freeborn woman to abort, whether, or not,
she should be seriously injured as a result of said act, she shall
undergo the same penalty provided in the cases of freeborn men.
ANCIENT LAW.
IV. Where a Freeborn Man Produces Abortion upon a Slave.
Where a freeborn man produces abortion upon a female slave,
he shall be compelled to pay twenty solidi to the master of the slave.
ANCIENT LAW.
V. Where a Slave Produces Abortion upon a Freeborn
Woman.
Where a slave produces abortion upon a freeborn woman, he
shall receive two hundred lashes in public, and shall be delivered up
as a slave to said woman.
ANCIENT LAW.
VI. Where a Slave Produces Abortion upon a Female Slave.
Where a male slave produces abortion upon a female slave, he
shall be compelled to pay ten solidi to her master, and, in addition,
shall receive two hundred lashes.
FLAVIUS CHINTASVINTUS, KING.
VII. Concerning Those who Kill their Children before, or after,
they are Born.
No depravity is greater than that which characterizes those who,
unmindful of their parental duties, wilfully deprive their children of life;
and, as this crime is said to be increasing throughout the provinces
of our kingdom and as men as well as women are said to be guilty of
it; therefore, by way of correcting such license, we hereby decree
that if either a freewoman or a slave should kill her child before, or
after its birth; or should take any potion for the purpose of producing
abortion; or should use any other means of putting an end to the life
of her child; the judge of the province or district, as soon as he is
advised of the fact, shall at once condemn the author of the crime to
execution in public; or, should he desire to spare her life, he shall at
once cause her eyesight to be completely destroyed; and if it should
be proved that her husband either ordered, or permitted the
commission of this crime, he shall suffer the same penalty.[35]
TITLE IV. CONCERNING INJURIES, WOUNDS, AND MUTILATIONS INFLICTED
UPON MEN.

I. Concerning the Injury of Freemen and Slaves.


II. Concerning Insolent Persons and their Acts.
III. Concerning the Law of Retaliation, and the Amount to be Paid in Lieu of
the Enforcement of said Law.
IV. Where a Person Deprives a Traveller of his Liberty, against the Will of the
Latter, and with Intent to do him Injury.
V. He who Violates the Law by Inflicting Injury upon Another, shall undergo
the same Punishment which he Himself Inflicted.
VI. He shall not be Considered Guilty who Struck Another, when the Latter
was about to Strike Him.
VII. Where a Slave Insults a Freeborn Person.
VIII. Where one Freeborn Person Strikes Another.
IX. Where the Slave of Another is Mutilated by a Freeborn Person.
X. Where a Slave Strikes a Freeborn Person.
XI. Where One Slave Mutilates Another Slave.

I. Concerning the Injury of Freemen and Slaves.


Where one freeborn person strikes another any kind of a blow
upon the head, he shall pay five solidi for a bruise, ten solidi if the
skin be broken, twenty solidi for a wound extending to the bone, and
a hundred solidi where a bone is broken. If a freeborn man should
commit any of the above named acts upon the slave of another, he
shall pay half of the above named penalties, according to the degree
of his offence. If one slave should strike another, as above stated, he
shall pay a third part of the above penalties, proportionate to his
offence, and shall receive fifty lashes. If a slave, however, should
wound a freeborn person, he shall pay the largest sum hereinbefore
mentioned, which is exacted from freeborn persons for assaults
upon slaves, and shall receive seventy lashes. If the master should
not be willing to give satisfaction for the acts of his slave, he must
surrender him on account of his crime.

II. Concerning Insolent Persons and their Acts.


If anyone with a drawn sword, or armed with any kind of weapon,
should insolently enter the house of another, with the design of killing
the master of the same, and should be himself killed, no one shall be
held responsible for his death; but if he who entered said house
should kill anyone, he shall be put to death at once. But if he should
not commit any crime, he must at once give satisfaction, according
to law, for any injury resulting from his act. And if he who entered the
house of another by violence, should steal anything there, he shall
be compelled to pay elevenfold the value of what he carried away.
And if he should not have the means to pay the amount due, he shall
be given up to serve as a slave; and if no damage should result from
his violent entrance into the house, and he should not steal anything
therefrom; for the mere fact of his forcible entry, he shall be
compelled to pay ten solidi and shall receive a hundred lashes in
public; and if he should not be possessed of said sum, he shall
receive two hundred lashes. If any other freeborn persons, who were
not under his orders or subject to him, or under his protection, should
enter with him into the house; all of them, as giving consent to a
high-handed and illegal act, shall undergo similar condemnation and
penalties. If they should not have the property wherewith to render
satisfaction, each one of them shall receive a hundred and fifty
lashes; but they shall not lose the right to testify in court. But if they
were under the protection, or in the service of the aggressor, and it is
proved that he ordered them to commit the act of violence, or that
they participated in it with him, the patron alone shall be held liable
for all damage committed, as well as for the penalty; for they were
not guilty who only carried out the orders of their superior. If a slave
should commit such an act of violence without the knowledge of his
master, he shall receive two hundred lashes, and shall be compelled
to restore whatever he carried away. If, however, the slave acted
with the knowledge of his master, the latter must give satisfaction for
his act, as has been hereinbefore provided in the cases of freeborn
persons.
FLAVIUS CHINTASVINTUS, KING.
III. Concerning the Law of Retaliation, and the Amount to be
Paid in Lieu of the Enforcement of said Law.
The bloody rashness of some persons must be legally revenged
by even the most severe penalties; for when anyone fears that he
will suffer for what he has done, he is liable to abstain from the
commission of crime. Therefore, if any freeborn person should dare
to shave the head of another; or should mark, or scar him by
violence inflicted either upon his face, or upon any other part of his
body, by the use of a scourge, a whip, or any weapon; or, by
maliciously dragging him upon the ground, should soil or defile him;
or should maim him in any part of his limbs; or should restrain him of
his liberty, by placing him in jail, or in any other place of confinement;
or should order him to be imprisoned by others; or to be kept in
custody and sold as a slave; having been apprehended by the judge,
the same person shall receive by way of retaliation, whatever he
inflicted, or attempted to inflict, upon another. And if he who suffered
from his violence, or endured insult through his agency, should
desire to receive pecuniary compensation from the culprit, he shall
be entitled to recover such a sum as he may estimate will
compensate him for the injuries he has sustained. We forbid,
however, retaliation to be made for a blow with the fist or with the
foot, or for any stroke upon the head; lest, when the retaliation is
inflicted, a greater or more dangerous injury may result.
Where an aggressor commits such acts without causing any
injury to the limbs, for a slap, he shall receive ten lashes; for a blow
with the fist, or a kick, he shall receive twenty lashes; for a stroke on
the head, if the blood should not flow, thirty lashes. And if he by
whom the injury was produced, or who is said to have instigated it,
where the act was not deliberately committed, but was the result of a
sudden quarrel, should prove that it was caused by the fault of
another, and against his own will, and, in the affray, an eye should
have been lost, he shall pay a hundred solidi as a penalty. But if it
should appear that the party injured can still see with the damaged
eye, he may accept a pound of gold from the aggressor, by way of
compensation. Where anyone is struck on the nose, and it should be
entirely destroyed, the culprit shall pay a hundred solidi. If the blow
upon the nose should be of such a character as to lay open the
nostrils, the judge shall impose a penalty according to the deformity
produced; and we decree that the same rule shall apply to injuries
done to the lips and to the ears. A hundred solidi shall be paid for
any injury to the loins. Whoever cuts off the hand of another entirely,
or injures it with a blow so that the party cannot make use of it, shall
pay a hundred solidi by way of reparation for such injury. Fifty solidi
shall be paid for the loss of the thumb; for that of the forefinger, forty
solidi; for that of the middle finger, thirty; for that of the fourth, twenty;
for that of the fifth finger, ten solidi. Similar sums also shall be
exacted for injuries inflicted upon the feet. For every tooth lost by
violence, twelve solidi shall be paid. Whoever breaks the leg of
another, and the latter thereby is rendered lame, shall pay him a
pound of gold; and all the provisions above stated in regard to such
injuries, shall apply where the rights of freemen are involved. But if a
slave should commit any of the unlawful acts hereinbefore specified,
or should he only shave the head of a freeman, he shall be delivered
up into the power of the latter to be dealt with according to his
pleasure. If, on the other hand, a freeborn person should shave the
head of a slave belonging to another, or should give orders to shave
the head of a peasant, he shall pay his master ten solidi. Where the
slave is of superior rank, the offender shall not only be forced to pay
the aforesaid sum of ten solidi to his master, but shall also receive a
hundred lashes. If he has maimed the slave in any part of his body,
or has ordered another to mutilate him, he shall receive two hundred
lashes; and shall be compelled to give to the master of said slave,
another of equal value to the one he has injured, by way of
satisfaction. And if any freedman should commit any of the crimes
hereinbefore specified against any freeman; for the reason that he
was of inferior rank, not only shall the violence he committed be
visited also upon him, but he shall, in addition, receive a hundred
lashes with the scourge. And if a person born free should injure a
freedman in any of the ways hereinbefore mentioned, he shall pay
the third part of the amount for which freeborn persons are liable. If
one slave should mutilate another without the knowledge of his
master, or should shave his head, he shall undergo the same injury
which he has inflicted, and shall receive a hundred lashes in public.
If a slave, without the knowledge of his master, should seize and
confine a freeborn person, he shall receive two hundred lashes in
public. But where a slave commits any of these acts, with the
consent of his master, the master only shall undergo the penalty, and
pay the damages which are prescribed by this law in the case of
freeborn persons. Where a freeborn person imprisons the slave of
another who is innocent, he shall pay three solidi to his master. If
one slave should imprison another, without the consent of the latter’s
master, he shall receive a hundred lashes. Where the slave
committed the act, with the knowledge of his master, the master of
said slave shall be compelled to pay three solidi. If any freeborn man
shall detain the innocent slave of another in custody, day or night, or
should cause him to be detained by another, he shall pay to the
master of the said slave, for every day that he is thus restrained of
his liberty, three solidi, and for every night an equal sum; and if the
innocent slave is proved to have been thus imprisoned by the said
freeman for several days, the latter shall be compelled to pay to the
master the same sum of three solidi for every single day and night
during which said slave was imprisoned. Any freeman who shall
strike the slave of another with a whip, or scourge, or any kind of
weapon, in such a way as to cause the blood to flow, or a bruise to
appear, shall pay to the master of the slave one solidus for every
blow inflicted; or, if serious injury should result, by which he who was
struck was either killed or maimed, the offender shall pay for such an
act, whatever sum the court, in its judgment, shall deem proper.
Where one slave commits an assault upon another slave, the judge
shall determine, according to the nature of the injury, the amount of
the sum to be paid by the slave, or his master; which sum shall be
equal to half that paid by a freeman under similar circumstances,
and the slave shall receive a hundred lashes, in addition, for his
insolence. All the provisions of this law shall apply to the cases of
men as well as to those of women, in order that the questions left to
the discretion of the judge by this and other laws, may be quickly
decided.
If a judge, influenced by friendship, or corrupted by a bribe,
should not dispose of a case in an equitable manner, or should
neglect to at once impose a penalty, he shall be deprived of his
judicial power for the future, and shall be compelled by the bishop, or
the governor, to render satisfaction out of his own property, to an
amount which said bishop or governor shall determine, to him to
whom he refused to do justice; in order that he, who voluntarily
refused to redress the wrongs of another, may be forced to undergo
the loss of his own possessions.
ANCIENT LAW.
IV. Where a Person Deprives a Traveller of his Liberty,
against the Will of the Latter, and with Intent to do him Injury.
If anyone, while on a journey, should be unlawfully restrained of
his liberty by another, and no indebtedness should exist between
them, he who has been so restrained shall be entitled to five solidi
for the injury he has undergone; and if the offender should not have
such a sum, he shall receive fifty lashes. But if one party should be
indebted to another, and should refuse to pay the debt, the creditor
may, without inflicting any injury upon him, bring him before the
judge of the district, and the latter shall make such an order as he
thinks to be just. Where a slave commits such an act, without the
order of his master, he shall receive a hundred lashes. But if he
should have done this under the direction of his master, said master
shall be liable for the payment of the sum hereinbefore mentioned.
FLAVIUS CHINTASVINTUS, KING.
V. He who Violates the Law by Inflicting Injury upon Another,
shall undergo the same Punishment which he Himself Inflicted.
It is no less a fault to be ignorant of the laws than, knowing them,
to commit crimes. Wherefore, whoever, up to this time, or hereafter,
has perpetrated, or shall perpetrate, any act forbidden by law, and
shall either declare that he was ignorant of the law, or shall plot to
carry out any act that shall enure to the injury or danger of anyone,
alleging, at the same time, that such act is not prohibited by law, and
that for this reason he cannot be held liable for its commission, and
should such person be convicted, he shall at once undergo the same
dangers, ignominy, tortures, suffering, or pecuniary loss, which he
inflicted, or attempted to inflict, upon another; shall receive, in
addition, a hundred lashes in public, and shall be scalped, as a mark
of perpetual infamy.[36]
FLAVIUS CHINTASVINTUS, KING.
VI. He shall not be Considered Guilty who Struck Another,
when the Latter was about to Strike Him.
It is no crime to resist another, where the violence of the attacking
party is manifest. Whoever, therefore, should recklessly attempt to
strike, or should strike, another with a whip, or sword, or with any
weapon whatsoever, and the offender should then be so wounded by
the party whom he attacks that he dies, such death shall not be
considered homicide, nor shall he be liable to any reproach who
struck the fatal blow; because it is more proper for a living person to
defend himself against an angry man, than to be revenged after his
own death. And whoever, in anger, draws a sword against anyone,
even though he should not strike him, shall be forced, on account of
his insolence, to give ten solidi to him whom he thus threatened.
FLAVIUS RECESVINTUS, KING.
VII. Where a Slave Insults a Freeborn Person.
No slave, however respectable he may be, shall act insolently,
arrogantly, or seditiously, towards a person of noble and illustrious
lineage; and, should one be guilty of such conduct, he shall be
sentenced by the judge to receive forty lashes with the scourge. A
slave of inferior position shall be punished with fifty lashes with the
scourge. Where a person of exalted rank first provokes the slave of
another, and is insulted in consequence, he must attribute it to his
own bad behavior; since, as he was forgetful of honor and patience,
he only received what he deserved.
ANCIENT LAW.
VIII. Where One Freeborn Person Strikes Another.
If one freeborn person should inflict a wound upon another, and
the wounded person should die at once, the attacking party shall be
punished for homicide; and if he who was wounded should not die
immediately, the aggressor must either be confined in prison, or
released on bail. Should the person who was wounded escape with
his life, he who injured him must pay him twenty solidi, on account of
the attack alone; and, if he should not have that sum, he shall
receive two hundred lashes in public, and, in addition to this, he shall
be compelled to pay such damages, for the wound he inflicted, as
may be assessed by the judges.
ANCIENT LAW.
IX. Where the Slave of Another is Mutilated by a Freeborn
Person.
If any freeman should voluntarily mutilate the slave of another, he
shall be compelled to give at once to his master, another slave of
equal value; and he shall retain the one that was injured, to be cared
for at his expense until he is cured. And if he should afterwards
recover, the person who inflicted the wound shall pay such an
amount in damages as may seem just to the court. And should he,
afterwards, be restored to his master, safe and sound, said master
shall receive him again as his slave. The aggressor, on account of
the boldness of his act, inasmuch as he did not commit murder, but
only ventured to wound the slave of another, shall pay ten solidi to
his master.

X. Where a Slave Strikes a Freeborn Person.


If a slave, without the order of his master, should strike a freeborn
person, and the latter should die at once, from the effect of the blow,
the slave shall be punished for homicide; but if the wounded person
should not die immediately, the slave shall be imprisoned; and if he
who was wounded should recover, his assailant shall receive two
hundred lashes. The master, if he should wish to do so, may pay, in
satisfaction of the injury, whatever sum may be assessed by the
court; and, if he should refuse to do this, the slave shall be given to
the party injured, in satisfaction for his crime.

XI. Where One Slave Mutilates Another Slave.


Where one slave inflicts mutilation upon another, he shall receive
a hundred lashes, in addition to the pecuniary satisfaction due for the
wound; and if, as a result of said wound, the other should be partially
disabled, the judge shall estimate how much his value has been
diminished in consequence. If his master should refuse to accept the
sum thus estimated, as satisfaction, he shall be entitled to receive
the price of the slave who was injured, or one of equal value, from
him whose slave committed the attack; and said master shall retain
the mutilated slave as his own. We decree that this law shall also
apply to female slaves.
TITLE V. CONCERNING HOMICIDE.

I. Where One Kills Another without Knowing it.


II. Where One Kills Another without Seeing Him.
III. Where One, being Pushed, Kills Another.
IV. Where One, Seeking to Strike Another, Kills a Third Person.
V. Where One is Killed while Interfering in a Quarrel.
VI. Where One, Intending to Inflict a Slight Injury, Kills Another.
VII. Where One, in Sport, or Recklessly, Kills Another.
VIII. Where One Kills Another through Immoderate Punishment.
IX. Where a Freeman Kills a Slave by Accident.
X. Where a Slave Kills a Freeman by Accident.
XI. Where One Man Intentionally Kills Another.
XII. No Master shall Kill his Slave without Good Reason; and Where One
Freeman Kills Another.
XIII. No One shall Deprive a Male or Female Slave of a Limb.
XIV. Any Person may bring an Accusation of Homicide.
XV. Both Relatives and Strangers have a Right to Accuse a Person of
Homicide.
XVI. Where a Homicide Takes Refuge in a Church.
XVII. Concerning Parricides, and the Disposition of their Property.
XVIII. Concerning Those who Kill Others Related to Them by Blood.
XIX. Where One Blood Relative is Accidentally Killed by Another.
XX. Where One Slave Kills Another by Accident.
XXI. Concerning Those who Destroy their Souls by Perjury.

FLAVIUS RECESVINTUS, KING.


I. Where One Kills Another without Knowing it.
Whoever kills another ignorantly and unintentionally, if he has
cherished no animosity against him, is not guilty of murder according
to the Word of God; for it is not just that he should suffer the penalty
of homicide who committed the act against his will.
FLAVIUS CHINTASVINTUS, KING.
II. Where One Kills Another without Seeing Him.
If one man should kill another, either standing, coming, or
passing by, not being aware of his presence at the time, where no
cause of enmity had previously existed between them, and he who
committed the homicide shall declare that he did it involuntarily, and
shall be able to prove this in court, he shall depart in safety.
FLAVIUS RECESVINTUS, KING.
III. Where One, being Pushed, Kills Another.
If anyone, either by accident, or by being pushed in any way, or
by rushing headlong upon another, should kill him, he shall not be
liable to the penalties of homicide. But if one man should push
another, and, impelled by that push, the latter should kill a third party,
and he who gave the push did so without malice, he shall pay a fine
of a pound of gold, because he neglected to avoid the commission of
an injury.
THE GLORIOUS FLAVIUS RECESVINTUS, KING.
IV. Where One, Seeking to Strike Another, Kills a Third
Person.
Whenever, in a quarrel, anyone, while endeavoring to strike his
adversary, unwillingly kills a third person, a legal investigation must
be made to determine who originated the quarrel; and if it should be
found that he was guilty who was first struck at, then he who stirred
up the strife, although he escaped the blow, yet, because it is
apparent that he was the cause of the homicide, shall pay a fine of a
hundred golden solidi. He who struck the blow shall pay fifty solidi to
the nearest relatives of the person who was killed. Thus both pay a
penalty; one, because he intentionally gave an opportunity for the
commission of homicide; the other, because he unintentionally
committed said homicide.
FLAVIUS RECESVINTUS, KING.
V. Where One is Killed while Interfering in a Quarrel.
If any freeman should interfere in a quarrel for the purpose of
making peace, and should be killed in consequence, and he who
struck him shall be able to prove, either by his own oath, or by the
testimony of respectable witnesses, that the act was not committed
intentionally, because the party who struck the fatal blow did not wish
to commit assault or homicide upon the person who was killed, he
shall pay a pound of gold to the relatives of the person who lost his
life; and, in like manner, if any wound was inflicted under similar
circumstances, the person who inflicted it shall pay a third part of the
aforesaid sum; for the reason that the death of him who interfered for
the purpose of making peace should not be unavenged.
FLAVIUS RECESVINTUS, KING.
VI. Where One, Intending to Inflict a Slight Injury, Kills
Another.
Where anyone, attempting to commit an injury, gives a kick, or a
blow with the fist, or commits any other violent act, and death should
result, the guilty party shall be punished for homicide.
VII. Where One, in Sport, or Recklessly, Kills Another.
Whoever incautiously, or recklessly, or in sport, or in a crowd,
unintentionally, by a fatal blow, strikes or kills anyone; because no
malicious intention or desire to injure existed, shall incur no infamy
for having committed an assault or homicide, even though he should
be convicted by oath, or by the testimony of witnesses; nor shall he
be liable to punishment by death, because he did not kill the person
intentionally. But, for the reason that he struck the fatal blow without
due caution, and did not attempt to avoid an accident, he shall pay a
pound of gold to the nearest relatives of the deceased, and shall
receive fifty lashes with the scourge.
FLAVIUS RECESVINTUS, KING.
VIII. Where One Kills Another through Immoderate
Punishment.
If it should happen that a scholar, or any person under the
patronage, or in the service of another, while undergoing moderate
corporeal punishment, inflicted by his teacher, patron, or master,
should die as a result of the same; and that he who inflicted the
punishment entertained neither hatred or malice toward him whom
he killed; he shall neither be rendered infamous, nor punished on
account of the homicide; for the reason that it is said in the Holy
Word of God that he shall be unhappy, who does not inflict
punishment.
FLAVIUS RECESVINTUS, KING.
IX. Where a Freeman Kills a Slave by Accident.
If a freeman should kill a slave not intentionally, but by accident,
he shall be compelled to pay to the master of the slave one-half of
the amount which has been provided by way of reparation in the
case of freeborn persons, under similar circumstances.
FLAVIUS RECESVINTUS, KING.
X. Where a Slave Kills a Freeman by Accident.
If a slave should kill a freeborn person not intentionally, but
accidentally, he shall pay the same sum which a former law has
provided in the case of other freeborn persons. But if the master
should be unwilling to pay said sum for his slave, the latter must, at
once, be given up to justice.
ANCIENT LAW.
XI. Where One Man Intentionally Kills Another.
Every man who kills another intentionally, and not by accident, is
liable to punishment for homicide.
FLAVIUS CHINTASVINTUS, KING.
XII. No Master shall Kill his Slave without Good Reason; and
Where One Freeman Kills Another.
If anyone who is guilty of crime, or of giving wicked counsel to
another, cannot escape punishment, how much more liable is he
who deliberately and maliciously commits homicide? For this reason,
as very frequently, through the excesses of cruel masters, slaves are
deprived of their lives, without having committed any crime; it is
proper that this license should be entirely abolished by means of the
following law, which shall be hereafter observed by all, to wit: that no
master or mistress shall deprive either their own slaves, or the
slaves of others, of life, without an order of court. But if such a slave
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like