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. 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.

Did you Know?

The website templates are available to hasten the startup involved in creating a web application. The Personal Web Site Starter Kit template, for example, will build a website with a number of existing pages and features to help you in creating a personal website. (For more information on this template, see http://msdn.microsoft.com/asp.net/archive/default.aspx?pull=/library/enus/dnaspp/html/pws.asp.)

Be sure to try out the Search Online Templates feature in the My Templates section. This option, if selected, will look online for additional website templates created and distributed by Microsoft and others.


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 endssurfing 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.

Did you Know?

A gaggle of web-hosting companies is available with various features and pricing plans. You can find these web-hosting companies through any search engine or through sites such as HostIndex.com or TopHosts.com, which serve as a directories of web-hosting companies.

If you decide to host your ASP.NET website with a web-hosting company, be sure to check (and double-check) with the company to ensure that its servers support ASP.NET 2.0.


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. 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.

By the Way

If your personal computer doesn't have Microsoft's IIS web server installed, you may be wondering how, in the preceding hour, we were able to view an ASP.NET page through a browser. This is possible because Visual Web Developer ships with a scaled-down web server referred to as the ASP.NET Development Web Server.

This web server is designed solely for testing websites locally and will refuse any attempted access from outside your own computer. It is shipped with Visual Web Developer, so those developers who run Windows XP Home, which does not support IIS, can still create, build, and test ASP.NET applications.


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.

By the Way

If you have a programming background in Java or C/C++, you may be more familiar with Visual C# than Visual Basic. Visual Basic is typically preferred by those with a background in the language or those new to programming.

If you are interested in learning more about Visual C#, check out Microsoft's Visual C# Developer Center (http://msdn.microsoft.com/vcsharp/) along with Microsoft Visual C# 2005 Unleashed by Kevin Hoffman (ISBN: 0672327767).


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.)




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net