Understanding Web Communication

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
Team-Fly    

Special Edition Using Microsoft® Visual Basic® .NET
By Brian Siler, Jeff Spotts
Table of Contents
Chapter 17.  Using Active Server Pages.NET


Web browsing is a process of communication between clients and servers on a network. The clients are the users running browser software, such as Internet Explorer or Netscape. The servers are Web servers, such as Microsoft's Web server product, Internet Information Server (IIS). The network can be the worldwide Internet or a even an isolated corporate intranet. To use Active Server Pages.NET, you need access to a machine that is running the IIS software and has the .NET Framework installed. If you are not already running IIS, it can be installed on most of the recent Microsoft operating systems, including Windows 2000 Professional. For the purposes of this chapter, your Web server can be the same machine that you are using for Visual Studio development.

For more details on finding a Web server and installing IIS, p.49

Creating Web Directory Structures

After you have access to a Web server, making a Web page available to other users on the network is simply a matter of placing a file on the Web server. To access a given Web page, the end user simply enters the URL, as in the following example:

 http://www.vbinsider.com/Family/Pictures/Reunion.htm 

The previous example address indicates the Web server name, www.vbinsider.com, as well as the desired Web page, /Family/Pictures/reunion.htm. On a given Web server, the "root" directory is considered to be the top-level Web site. The reunion.htm page is two levels deep, inside the /Family/Pictures subdirectory. This works very much like the directory structure in the Windows operating system, with two important exceptions:

  • Web servers have virtual directories, which allow the name and location of a Web folder to remain independent from the corresponding physical folder on the disk.

  • Virtual directories (and the pages contained within them) on an IIS server are considered to be ASP.NET applications.

To further expound on the significance of virtual directories, consider the following sample Web sites, which might be set up on a typical corporate intranet:

 http://myintranet/hr  http://myintranet/accounting 

In this example, hr and accounting would probably be set up as separate virtual directories. Files related to hr would be placed in the hr folder, such as a corporate phone book search. As you will learn in the upcoming section, "Configuring Your ASP.NET Application," ASP.NET applications share common configuration properties and can exchange information between pages.

Note

IIS allows you to specify default document names for an application, usually default.htm,default.asp, or default.aspx. (The last extension, .aspx is new to ASP.NET). The default document (if it exists) is displayed when a Web surfer just requests the virtual directory name without specifying a file; that is http://server/ASPTest.


When creating a directory structure on your Web server, the names and organization seen by the Web do not necessarily have to match those on the Web server. For example, the /hr virtual directory might correspond to the subdirectory d:\hrfiles\productionwebsite\ on the hard drive.

Note

Any subdirectories created within a virtual directory (that are not virtual directories themselves) are part of the same ASP.NET application as their parent directory.


Creating a Virtual Directory in IIS

The first step in setting up a new ASP.NET application on your Web server is creating the virtual directory. To demonstrate, we'll set up a directory for the samples in this chapter. When you download the sample files, you can copy them to the folder that corresponds to your virtual directory. To create the new Web site, perform the following steps:

  1. Open Windows Explorer or My Computer and find the C:\Inetpub\wwwroot directory. This is the root directory of your Web server, which was created when IIS was installed.

  2. Right-click an empty area in the wwwroot folder and choose New Folder. Create a new folder called ASPTest.

  3. Return to your computer's desktop. Right-click the My Computer icon and choose Manage.

  4. When the Computer Management screen appears, navigate to Services and Applications, Internet Information Services. This part of the management console, shown in Figure 17.1, is used to manage your Web server directories.

    Figure 17.1. The Internet Services manager and other management utilities are integrated into the Microsoft Management Console.

    graphics/17fig01.gif

  5. Right-Click Default Web Site and choose New, Virtual Directory.

  6. Click Next and you will be prompted for the directory Alias. This is the name that browsers will use to access pages in the virtual directory. To create the sample directory for this chapter, enter ASPTest and click Next.

  7. The next screen prompts you for the path to the physical directory. Enter the path of the folder you just created with Windows Explorer, C:\Inetpub\wwwroot\ASPTest, and click Next.

    Note

    In the scenario presented here, the virtual directory name and physical directory name are the same. This arrangement is very typical of what happens in the real world. However, your Web pages do not have to be located in the existing C:\Inetpub\ wwwroot structure, nor does the virtual directory name have to match the Windows folder name.

  8. On the Access Permissions screen, make sure the Read and Run Scripts options are selected. Click Next and then Finish to complete the operation.

When you have finished creating the new virtual directory, close the Computer Management screen. You are now ready to begin placing your Web site files in the ASPTest folder.

Tip

If you have not already done so, change the default Windows Explorer Folder Options to make working with files easier. By default, Windows hides file extensions and other information not required by the average user. However, as a programmer you will certainly require detailed access to operating system files. To change these settings, choose Folder Options from the Tools menu, and select the View tab. Next, uncheck the options to hide file extensions and system folders.



    Team-Fly    
    Top
     



    Special Edition Using Visual Basic. NET
    Special Edition Using Visual Basic.NET
    ISBN: 078972572X
    EAN: 2147483647
    Year: 2001
    Pages: 198

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