Partilhar via


Web Site Administration

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

Suppose you just deployed an expensive, new Web site only to discover that a company logo was omitted from all of the site's pages. Or, imagine that you are suddenly asked to route thousands of users to alternate Web sites while technicians scramble to troubleshoot a malfunctioning computer. Such issues only begin to hint at the day-to-day challenges of successfully managing a Web site. And although effective Web site management ultimately depends on an administrator's skill, there are a number of basic tools and procedures that you can use to deal with the most common management tasks and emergencies.

Getting Started

To begin with, you should set up your Web sites by indicating which directories contain the documents that you want to publish. The Web server cannot publish documents that are not within these specified directories. So, the first step in deploying a Web site should be to first determine how you want your files organized. You then use IIS Manager to identify which directories are part of the site.

If you want to get started right away without having to create a special directory structure and your files are all located on the same hard disk of the computer running Internet Information Services (IIS), you can publish your documents immediately by copying your Web files into the default home directory, LocalDrive:\Inetpub\Wwwroot. (For an FTP site, copy your files into LocalDrive:\Inetpub\Ftproot.) Intranet users then can access these files with the following URL: https://servername/filename. To learn how to host multiple sites and organize disparate Web content, see the procedures in this section. They explain such things as how to change the default location of your files and how to add directories that are located on other hard disks or on computers across the network.

Home Directories

Each Web or FTP site must have one home directory. The home directory is the central location for your published pages. It contains a home page or index file that welcomes visitors and contains links to other pages in your site. The home directory is mapped to your site's domain name or to your server name. For example, if your site's Internet domain name is www.microsoft.com and your home directory is C:\Website\Microsoft, then browsers use the URL https://www.microsoft.comto access files in your home directory. On an intranet, if your server name is AcctServer, then browsers use the URL https://acctserver to access files in your home directory.

A default home directory is created when you install IIS, and when you create a new Web site. For instructions to change the home directory, see Setting Home Directories.

Virtual Directories

To publish from any directory not contained within your home directory, you must create a virtual directory. A virtual directory is a directory that is not contained in the home directory but appears to client browsers as though it were.

A virtual directory has an alias, or a name that Web browsers use to access that directory. Because an alias is usually shorter than the path name of the directory, it is more convenient for users to type. An alias is more secure because users do not know where your files are physically located on the server and cannot use that information to modify your files. Aliases make it easier for you to move directories in your site. Rather than changing the URL for the directory, you change the mapping between the alias and the physical location of the directory.

For example, suppose you are setting up a Web site for your marketing team on your company's intranet. The following table shows the mapping between the physical location of the files and the URL that accesses the files.

Physical Location Alias URL

C:\Inetpub\Wwwroot

home directory (none)

https://SampleWebSite

\\Server2\SalesData

Customers

https://SampleWebSite/Customers

D:\Inetpub\Wwwroot\Quotes

None

https://SampleWebSite/Quotes

D:\Inetpub\Wwwroot\OrderStatus

None

https://SampleWebSite/OrderStatus

D:\Marketing\PublicRel

PR

https://SampleWebSite/PR

Both virtual directories and physical directories (directories without an alias) appear in IIS Manager. A virtual directory is indicated by a wheel icon. The following illustration shows the Web site example described above, where /Customers and /PR are virtual directories.

For a simple Web site, you might not need to add virtual directories. You can simply place all of your files in the site's home directory. If you have a complex site or want to specify different URLs for different parts of your site, you can add virtual directories as needed.

Reroute Requests with Redirects

When a browser requests a page on your Web site, the Web server locates the page identified by the URL and returns it to the browser. When you move a page on your Web site, you can't always correct all of the links that refer to the old URL of the page. To make sure that browsers can find the page at the new URL, you instruct the Web server to give the browser the new URL. The browser uses the new URL to request the page again. This process is called "redirecting a browser request" or "redirecting to another URL." Redirecting a request for a page is similar to using a forwarding address with a postal service. The forwarding address ensures that letters and packages addressed to your original residence are delivered to your new residence.

Redirecting a URL is useful when you are updating your Web site and want to make a portion of the site temporarily unavailable, or when you have changed the name of a virtual directory and want links to files in the original virtual directory to access the same files in the new virtual directory.

Server-Side Includes

Often, it can be useful to dynamically alter Web content after the content has been requested, but before it gets returned to the browser. IIS includes a feature called server-side includes that provides this functionality.

Using server-side includes (SSI), you can carry out a number of of Web site management activities from adding dynamic time stamps to running a special shell command each time a file is requested. SSI commands, called directives, are added to Web pages at design time. When a page is requested, the Web server parses out all the directives it finds in a Web page and then executes them. A commonly used SSI directive inserts, or includes, the contents of a file into a Web page. For example, if you are required to continually update a Web page advertisement, you could use SSI to include the advertisement's HTML source in the Web page. To update the advertisement, you need only modify the file containing the advertisement's HTML source. You do not have to know a scripting language to use SSI; simply follow the correct directive syntax.

ASP and ASP .NET

ASP is a server-side scripting environment that you can use to create dynamic and interactive Web pages, and build powerful Web applications. When the application server receives a request for an ASP file, it processes server-side script code contained in the file to build the HTML Web page that is sent to the browser. In addition to server-side script code, ASP files can contain HTML (including related client-side scripts) as well as calls to COM components that perform a variety of tasks, such as connecting to a database or processing business logic. ASP requires you to use a scripting language, such as VBScript or JScript.

ASP .NET is the next generation of the Microsoft server-side scripting environment. It provides a new programming model and infrastructure, enabling Web developers to build and deploy enterprise-class Web applications that are more secure, scalable, and stable than ever before.