Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Build Your Own ASP.NET 2.0 Web Site Using CSharp And VB (2006) [eng]-1.pdf
Скачиваний:
142
Добавлен:
16.08.2013
Размер:
15.69 Mб
Скачать

5

Building Web Applications

 

In the previous chapters, we discussed the different pieces of ASP.NET in some detail. In this chapter, you’ll put together everything you’ve learned so far as we place this new knowledge in context. That’s right: it’s time to build your own web application!

Microsoft defines a web application as the collection of all files, pages, handlers, modules, and executable code that can be invoked or run within a given directory on a web server. The tool we recommend you use as you learn to build ASP.NET web applications is Visual Web Developer 2005 Express Edition, which is free but very powerful. You learned how to install this tool in Chapter 1, and in this chapter, we’ll teach you how to use it to its full potential.

It’s worth keeping in mind that you don’t have to use Visual Web Developer, or any other specialized tool, to develop ASP.NET web applications: any old text editor will do. However, we recommend using Visual Web Developer for any real-world project that’s more complex than a simple, “Hello World”-type example, because this tool can do a lot of the work for you as you build web applications.

Using Visual Studio

If you have access to Microsoft’s commercial Visual Studio program, you could make use of that instead of Visual Web Developer. When Visual Studio is started in Web Developer mode, its interface will look very similar to what you’ll see in this book. Visual Studio has a lot more features than

Chapter 5: Building Web Applications

Visual Web Developer, and a few of the tools are named differently to reflect this. For example, the Database Explorer window of Visual Web Developer is named Server Explorer in Visual Studio. For the purposes of this book, these tools are equivalent, and you should feel free to use Visual Studio if you have access to it.

In this chapter, you’ll learn about much of the functionality Visual Web Developer offers as we start to create an intranet for a company called Dorknozzle. Along the way, we’ll also explore many interesting ASP.NET features:

We’ll use Visual Web Developer to create web applications and edit files.

We’ll work with Web.config, Global.asax, and the special ASP.NET folders.

We’ll use the application state, user sessions, the application cache, and cookies.

We’ll debug your project and handle potential coding errors.

Introducing the Dorknozzle Project

While most books give you a series of simple, isolated examples to illustrate particular techniques, this book is a little different. Most of the examples provided in these pages will see us working on a single project: an intranet application for a fictional company called Dorknozzle. We’ll build on this application as we move through the remaining chapters of this book—the Dorknozzle intranet will give us a chance to investigate and grasp the many different concepts that are important to developers of any type of web application.

Now, real-world web development projects are built according to a detailed specification document, which includes, among other information, specific details of the site’s layout. We’ll assume that the pages in the Dorknozzle intranet will be laid out as shown in Figure 5.1.

The menu on the left suggests that the site will have more pages than this homepage, and that they’ll have the same structure: on every page of the site, the menu will sit on the left, and the header will be identical to the one shown here. Only the contents of each individual page will be different from the others. (If you paid attention in Chapter 4, you’ll already have realized that this is a scenario where it makes sense to use master pages.)

The intranet application we’ll develop will offer the following functionality:

144

Introducing the Dorknozzle Project

Figure 5.1. The Dorknozzle company intranet site

homepage

You can customize this page by including news about

 

the Dorknozzle company.

help desk

This page allows Dorknozzle employees to submit

 

problems they experience with software, hardware, or

 

their computers, as help desk tickets that are sent to

 

an IT administrator.

employee directory

Employees will likely want to call each other to discuss

 

important, company-related affairs … such as last

 

night’s television viewing! The employee directory

 

should let employees find other staff members’ details

 

quickly and easily.

address book

While the employee directory houses handy informa-

 

tion for staff use, the purpose of the address book is

 

to provide more detailed information about every em-

 

ployee within the company.

departments

The Departments page displays information about

 

Dorknozzle’s various departments.

145

Chapter 5: Building Web Applications

admin tools

Administrators will need the ability to perform various

 

administrative tasks, such as updating users’ informa-

 

tion. The Admin Tools section will provide the inter-

 

face for these kinds of interactions.

admin newsletter

This page will allow administrators to send email

 

newsletters to the company employees.

You’ll learn new techniques when building each of these pages. However, before you can begin to create all these smaller applications, we’ll need to build the framework that will act as a template for the site as a whole. Visual Web Developer will prove very helpful in such a project, so let’s start our discussion by getting a feel for its key features.

Figure 5.2. Using Visual Web Developer

146