Home > Articles > Programming > ASP .NET

Using Visual Web Developer to Build Pages in ASP.NET 2.0

This hour investigates Visual Web Developer in detail, focusing on specific topics like creating new websites and web pages, customizing the editor through Visual Web Developer’s Options menu, and accessing help through the installed documentation.
This chapter is from the book

In this hour, we will cover

  • Creating new websites and web pages
  • Opening existing websites
  • Customizing the editor through Visual Web Developer’s Options menu
  • Using techniques for laying out HTML content through the Design view
  • Moving and resizing the assorted windows
  • Accessing help through the installed documentation

In the preceding hour we looked at the ASP.NET programming model, noting how ASP.NET pages are composed of an HTML portion and a source code portion. Recall that the HTML portion of an ASP.NET web page consists of static HTML markup and Web control syntax; the source code portion, separated out into its own file, is implemented as a class with various event handlers.

In the past two hours, you got a cursory look at Visual Web Developer, the development environment we’ll be using throughout this book to build ASP.NET pages. In Hour 1, "Getting Started with ASP.NET 2.0," we installed Visual Web Developer and received a quick tour of its features. In the preceding hour we delved a bit deeper into Visual Web Developer’s interface, looking at how to create a new ASP.NET website and how to use the WYSIWYG Design view, the HTML Source view, and the source code editor.

Because we’ll be using Visual Web Developer extensively throughout this book, it behooves us to take a moment to fully explore this editor. Visual Web Developer is a sophisticated and powerful programming editor, with a bevy of features and capabilities. As with any profession, it’s important to have a solid grasp of the tools at your disposal.

Creating a New Website

When you start Visual Web Developer, you will typically want to do one of two things: either create a new website or open an existing website. A website is a collection of resources: static and dynamic web pages, graphic files, style sheets, configuration files, and so on. In addition to various files, a website may contain subdirectories, each of which may contain its own set of files and further subdirectories. A website is akin to a folder on your personal computer: It’s a repository for files and subfolders.

To create a new website with Visual Web Developer, go to the File menu and select New Web Site or simply click the New Web Site icon in the Toolbar. Either of these actions will bring up the New Web Site dialog box, shown in Figure 3.1.

Figure 3.1

Figure 3.1 Create a new website from the New Web Site dialog box.

Choosing a Website Template

When creating a new website, you can choose among a number of available templates. For example, there’s the ASP.NET Web Site template, the ASP.NET Web Service template, the Personal Web Site Starter Kit template, and an Empty Web Site template. Regardless of what template is selected, a website will be created; the differences among the templates is what default files the template includes with the website. For example, in the preceding hour we saw that creating a new website using the ASP.NET Web Site template creates a website with an App_Data folder and three files: Default.aspx, Default.aspx.vb, and web.config. Creating a website using the Empty Web Site template will create the website but will not add any default folders or files.

Although there is an array of website templates to choose from, all of the examples in this book will be created using the ASP.NET Web Site template.

Specifying the Website’s Location

Websites can be located either on your personal computer or on a remote computer. Typically, personal computers do not double as web servers; that is, chances are the personal computer on which you’re working right now does not host websites. Rather, you use your PC for your own ends—surfing the web, checking email, playing games, and so on. Publicly available websites are often hosted through web-hosting companies, which offer always-on computers with a persistent connection to the Internet. These computers’ sole purpose is to host a website; they have web server software running on them and essentially sit around and wait for incoming requests. Upon receiving a request for a web page, they render the page and return the resulting markup to the requesting browser.

Often developers place a website on their own personal computer during the building and testing phases. The site won’t be accessible over the Internet, but that’s okay because the site is not yet ready for the public. When a functional site is complete, though, it can be moved to a remote web-hosting company so that the site can be accessed by anyone with an Internet connection. However, you can opt to create a new site on a remote computer from the get-go. All you need is an account with a web-hosting company.

If you opt to host the website on your local computer you can host it in, potentially, one of two ways:

  • Through the file system—With this approach, you provide a directory on your hard drive that serves as the website’s root directory. All of the site’s associated files and folders will be placed in that specified directory.

  • Through IIS, Microsoft’s Web server—If your personal computer has Internet Information Services (IIS) installed, you can host the website locally through IIS. IIS can be installed on Windows XP Professional and Windows 2003 Server; it is not able to be installed on Windows XP Home edition.

If you want to host the site locally, from the Location drop-down list, select File System. Next, click the Browse button to the right of the Location drop-down list. This will bring up the Choose Location dialog box shown in Figure 3.2.

Figure 3.2

Figure 3.2 Choose the location where your website will reside.

The left column in the Choose Location dialog box lists the various locations the website can be saved.

To host the website on a remote computer, select either the HTTP or FTP options for location and specify the HTTP or FTP address. For the FTP settings, you’ll need to provide the FTP server, port, directory, and username/password, if anonymous access is not allowed. Similarly, if you choose to use the HTTP setting when attempting to create the website, you’ll be prompted for a username and password. Contact your web-hosting company for information on whether you should use HTTP or FTP access and what settings you’ll need to use in order to connect.

All of the websites throughout this book will be created on the local file system.

Choosing the Source Code Programming Language

The setting chosen in the Language drop-down list specifies the programming language of your ASP.NET web pages’ source code portions. Two options are available: Visual Basic and Visual C#. As discussed in the preceding hour, the Visual Basic language will be used for the examples throughout this book.

To gain practice creating websites in Visual Web Developer, go ahead and create a new website using the ASP.NET Web Site template, the File System location with the website in a directory of your choice, and with the Language set to Visual Basic. As we saw in the preceding hour, this will create a website with an App_Data folder, a Default.aspx ASP.NET page (with a corresponding Default.aspx.vb file), and a configuration file, web.config. These files are listed in the Solution Explorer, which you can find in the upper-right corner. (If you do not see the Solution Explorer, go to the View menu and choose the Solution Explorer option.)

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020