ASP. NET Website Programming shows you how to build an interactive website from
design to deployment. Packed with solutions to website programming problems, this book will have you building well-engineered, extendable ASP. NET websites quickly and easily. What you will learn from this book
With ASP. NET Website Programming you will learn to:
Establish a solid, scalable website foundation
Provide flexible user accounts by integrating with ASP. NETs built-in security
Create fully featured discussion forums
Generate revenue from advertising
Build a web interface for managing the files on your site
Add opinion polls, e-mail newsletters, and news management
Deploy the finished site on a live server
Build websites using good, n-tier coding techniques
The book's P2P forum is a platform for exchanging code and ideas, helping to extend the website with new modules and modifications.
What you need to know
This book is for developers who:
Use ASP. NET and Visual Basic .NET
Use Visual Studio .NET Professional or above, or Visual Basic .NET Standard
Welcome to ASP.NET Website Programming. In this book we will build an interactive, content-based website using expandable, interchangeable modules. By the end of the book you will have developed your ASP.NET skills for producing effective, well-engineered, extendable websites.
ASP.NET is a great tool for building websites. It contains many built-in features that would take thousands of lines of code in classic ASP, and it does not require admin rights in order to deploy compiled components - your whole site can be deployed in one folder.
This book will guide you through the bewildering features available to ASP.NET developers,
highlighting the most useful and exciting. The book concentrates on websites that focus on content. It does not show how to produce an e- commerce system, although a lot of the advice will apply to e-commerce sites. We could add a shopping basket module using the same foundations, for example.
This book is different from most Wrox books, because we build a single working website throughout the book. However, each chapter stands alone and shows how to develop individual modules, which you can adapt for your own websites. We also suggest a framework that allows us to create modules and slot them in to the website quickly and easily.
What Does This Book Cover?
The chapters in this book follow a problem-design-solution pattern. First we identify what we need to achieve, then we sketch out how we will achieve it, and finally we build the software in Visual Studio .NET.
Most chapters involve building a 3-tier system, with data, business, and presentation layers. We will also see how to build separate modules so that they integrate well into the whole site.
Chapter 1 looks at the website as a whole. We identify the problem that it is trying to solve, and discuss how we will go about solving it. We then come up with a solution - which involves building and integrating the modules detailed in the other chapters.
Chapter 2 builds the foundations of our site. We set coding standards and design our folder and
namespace structure. We create our initial database - although at this stage we have no data to put in it. We also build site-wide error handling code and base classes for our data and business layer objects.
Chapter 3 extends our foundations to the presentation layer. We build base classes for the ASP.NETpages in the site, a custom error page, and site-wide navigation, header, and footer controls.
Chapter 4 presents a file management module, which we can use to download and upload source codefor the site, and make changes online. We will also look at Microsoft's Data Manager, which enables us to manage SQL Server databases through our website.
Chapter 5 covers user accounts. We look at how to create a powerful role-based security system, and integrate it with ASP.NET's built-in authentication features.
Chapter 6 shows how to provide regularly changing news content through a website. We also build a web service to expose news headlines to other sites and applications, and a Windows news ticker that uses this web service.
Chapter 7 looks at advertising. We create our advertising system by extending the ASP.NET AdRotator control to provide the power we need. We look at logging hits and impressions, and providing reports to advertisers.
Chapter 8 covers opinion polls and voting. We look at how to administer questions, log votes, and collate them into useful reports.
Chapter 9 provides the tools to create e-mail newsletters. We will look at how to create messages in plain text and HTML, and how to administer lists and set up new ones.
Chapter 10 looks at forums. We create everything you need to post and read messages, and give administrators special permissions. Along the way, there is some powerful use of the DataList and DataGrid controls. We also look at how to use regular expressions to provide limited HTML support, without opening our forum to the risk of cross-site scripting.
Chapter 11 shows how to deploy the site. We will look at the ways Visual Studio .NET allows us to provide source-free distributable versions of our software, and how to deploy our sites onto hosting services.
Chapter 12 looks to the future. We've only just begun our lives as ASP.NET website developers and here we will look at ways in which Wrox can support your continued development. In particular this includes the book's P2P list, where you can work together with fellow readers and benefit from each other's ideas and experience.
Who Is This Book For?
The book is for developers who have a reasonable knowledge of ASP.NET, and want to apply that knowledge to building websites. You will get the most from this book if you have read a decent amount of Wrox's Beginning ASP. NET using Visual Basic .NET, or Pro)~ssional ASP. NET and a VB.NET book.
You should be comfortable using Visual Studio .NET to create ASP.NET projects, and that you know VB.NET.
What You Need to Use This Book
To run the code samples in this book you need to have the following:
Windows 2000 or Windows XP.
Visual Studio .NET 1.0. We have tested the code for version 1.0, although most of the code should work in late pre-release versions. Nearly everything will also work in Visual Basic .NET Standard.
SQL Server 2000 - although most of the techniques we use could apply to any database system, including Access.
To get the site working you may also need an ASP.NET web host. We will give some guidance on choosing one towards the end of the book.
Conventions
We've used a number of different styles of text and layout in this book to help differentiate between the different kinds of information. Here are examples of the styles we used and an explanation of what they mean.
Code has several styles. If it's a word that we're talking about in the text - for example, when discussing a For...Next loop, it's in this font. If it's a block of code that can be typed as a program and run, then it's also in a gray box:
Sometimes we'll see code in a mixture of styles, like this:
Widget
S10 . O0
< / invoice>
In cases like this, the code with a white background is code we are already familiar with; the line highlighted in gray is a new addition to the code since we last looked at it.
Advice, hints, and background information comes in this type of ~nt.
Important pieces of information come in boxes like this.
Bullets appear indented, with each new bullet marked as follows:
Important Words are in a bold type font.
Words that appear on the screen, or in menus like File or Window, are in a similar font to the one you would see on a Windows desktop.
Keys that you press on the keyboard, such as Ctrl and Enter, are in italics.
Customer Support We want to hear from you! We want to know what you think about this book: what you liked, what you didn't like, and what you think we can do better next time. Please send us your comments, either by returning the reply card in the back of the book, or by e-mailing feedback@wrox.com. Please mention the book title in your message.
We do listen to these comments, and we do take them into account on future books.
How to Download the Code for the Website
It is well worth getting the website working on your own machine before reading too much of this book. It will help you follow the descriptions, because you will be able to see how code snippets relate to the whole application, and experience the modular approach first hand.
To get the code, visit www.wrox.com and navigate to ASP. NET Website Programming Visual Basic .NET
Edition. Click on Download in the Code column, or on Download Code on the book's detail page.
The files are in ZIP format. Windows XP recognizes these automatically, but Windows 2000 requires a de-compression program such as WinZip or PKUnzip. The archive contains the whole site, plus a readme describing how to get it up and running.
Errata
We've made every effort to make sure that there are no errors in the text or in tile code. If you do find an error, such as a spelling mistake, faulty piece of code, or any inaccuracy, we would appreciate feedback. By sending in errata you may save another reader hours of frustration, and help us provide even higher quality information.
E-mail your comments to support@wrox.com. Your information will be checked and if correct, posted to the errata page for that title, and used in subsequent editions of the book.
To find errata for this title, go to www.wrox.com and locate ASP. NET Website Programming Visual Basic .NET Edition. Click on the Book Errata link, which is below the cover graphic on the book's detail page.
E-mail Support
If you wish to directly query a problem in the book with an expert who knows the book in detail then e-mail support@wrox.com, with the title of the book and the last four numbers of the ISBN in the subject field of the e-mail. Please include the following things in your e-mail:
The title of the book, last four digits of the ISBN (8163), and page number of the problem in the Subject field.
Your name, contact information, and the problem in the body of the message.
We won't send you junk mail. We need the details to save your time and ours. When you send an e-mail message, it will go through the following chain of support:
Customer Support - Your message is delivered to our customer support staff, who are the first people to read it. They have files on most frequently asked questions and will answer anything general about the book or the website immediately.
Editorial - Deeper queries are forwarded to the technical editor responsible for that book.
They have experience with the programming language or particular product, and are able to answer detailed technical questions on the subject.
The Authors - If even the editor cannot answer your problem, they will forward the request to the author. We do try to protect the author from any distractions to their writing, but we are happy to forward specific requests to them. All Wrox authors help with the support on their books. They will e-mail the customer and the editor with their response, and again all readers should benefit.
The Wrox Support process can only offer support to issues that directly relate to the content of the book. Support for questions that fall outside the scope of normal book support is provided via the community lists of our http://p2p.wrox.com/forum.
p2p.wrox.com
For author and peer discussion join the P2P mailing lists. Our unique system provides programmer to programmerTM contact on mailing lists, forums, and newsgroups, all in addition to our one-to-one e-mail support system. If you post a query to P2P, you can be confident that the many Wrox authors and industry experts who use our mailing lists will examine it. At p2p.wrox.com you will find a number of different lists that will help you, not only while you read this book, but also as you develop your own applications.
This book has its own list called aspdotnet website programming. Using this, you can talk to other people who are developing websites using the methods and framework presented here. You can share ideas and code for new and improved modules, get help with programming headaches, and show off the
sites you've written!
To subscribe to a mailing list just follow these steps:
1. Go to http://p2p.wrox.com/.
2. Choose the appropriate category from the left menu bar.
3, Click on the mailing list you wish to join.
4. Follow the instructions to subscribe and fill in your e-mail address and password.
5, Reply to the confirmation e-mail you receive.
6, Use the subscription manager to join more lists and set your e-mail preferences.
Why This System Offers the Best Support
You can choose to join the mailing lists or you can receive them as a weekly digest. If you don't have the time, or facility, to receive the mailing list, then you can search our online archives. Junk and spam mails are deleted, and the unique Lyris system protects your e-mail address. Queries about joining or leaving lists, and any other general queries about lists, should be sent to listsupport@p2p.wrox.com.