Editing ASP files

Because ASP files are simply text files, any text editor can be used to edit and create them. Visual Interdev Version 6 is Microsoft's tool for editing and creating ASP files. Developers commonly use other tools ranging from TextPad to Notepad to DreamWeaver. Visual Studio .NET is also a good choice for editing ASP files.

For this chapter, Visual Interdev is used to edit and create ASP files. Here's how to open a new ASP file with Interdev:

  1. Open Visual Interdev, and you'll be prompted to enter a project name. Click Cancel to close the prompt, and choose File | New File.

  2. Enter a filename and indicate the type of file you want to create.

  3. Click the ASP File icon and then click the Open button, as shown in Figure 12-2. The editor will present an ASP with template code for a generic HTML and a processing instruction at the top that indicates that the file language is VBScript.

    click to expand
    Figure 12-2: Creating a new ASP in Visual Interdev

VBScript is the default language for ASP pages. JScript, Microsoft's implementation of JavaScript, can also be used. VBScript is probably the most popular script language used by ASP coders, however, and in this chapter, all examples are shown in VBScript.

Visual Interdev offers the developer many useful features that are not available with other editors, which makes it useful for most ASP coding tasks. Using Interdev, a developer can debug code running on the server while stepping through the code line by line as the code is executed. The Auto List Member feature of IntelliSense is another feature offered by Interdev that is useful to the developer, because it ensures that the syntax the developer uses is correct. As keywords or commands of known libraries are typed by the developer, Interdev will suggest the proper spelling of the commands, as shown in Figure 12-3. Interdev will finish the command for the developer if the developer presses the TAB key. Interdev also color codes text to help distinguish between commands and content.

click to expand
Figure 12-3: Visual Interdev performing an Auto List Member

Visual Studio .NET is also an excellent tool for editing ASP. If Visual Studio .NET is available for use, ASP.NET should be used instead of ASP, unless a compelling reason exists for not using ASP.NET-for example, if ASPs adequately serve an existing need that requires an enhancement. In such a situation, rebuilding ASP files as ASP.NET files would not be useful. ASP.NET files and ASPs may be run side by side on an IIS 6 instance, so incremental introduction of ASP.NET into an ASP solution might be a consideration if there is a need for future enhancements and you want to migrate the solution to use the .NET Framework.

The filename extensions for ASP files are different from ASP.NET files. ASP.NET filenames end in .aspx or .asax. ASP filenames end in .asp or .asa. The file extension is the means by which IIS distinguishes the file types and determines the appropriate ISAPI extension to use on the file. For example, if an ASP file named MyAspFile.asp was renamed MyAspFile.aspx, the .NET Framework would process MyAspFile when it was requested instead of using the ASP ISAPI extension ASP.DLL. The use of Visual Studio .NET and ASP.NET will be covered in greater detail in Chapter 14.

Note 

Although ASP and ASP.NET can be hosted on the same web server instance running side by side, they cannot share a session, because each file type is processed by different software. The ASP files are processed by ASP.DLL, which in turn uses WSH to execute the script commands. The ASP.NET files are processed by aspnet_isapi.dll, which in turn uses the .NET Framework to execute the code.

The disadvantage of using Visual Interdev is primarily that it is resource intensive, so it takes a long time to open and use on simple tasks. If a developer needs to make a quick edit, for example, Notepad or Textpad will open quickly and provide enough functionality to allow the edit to be made and the file to be saved and closed. Visual Interdev is a licensed software product that must be purchased, so when it is compared to the other alternatives, it is the most expensive option.




IIS 6(c) The Complete Reference
IIS 6: The Complete Reference
ISBN: 0072224959
EAN: 2147483647
Year: 2005
Pages: 193

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