ASP.NET Pages End with the Extension .aspx


ASP.NET Pages End with the Extension .aspx

ASP Classic pages end with the extension .asp , and ASP.NET pages end with the extension .aspx . This fact can be very inconvenient if you have existing links to your Web site. For example, you might have a Web site with hundreds of existing pages with names that end with the extension .asp and that have already been indexed by a search engine, such as AltaVista or Google. You might not want to change the extension of these filenames because you fear that you'll lose ranking in the search engines.

You can, in fact, use any extension that you want for ASP.NET pages. To change the extension used for ASP.NET pages, follow these steps:

  1. Launch the Internet Services Manager by choosing Start, Programs, Administrative Tools, Internet Services Manager.

  2. Open your Web site's property sheet by right-clicking the name of your Web site and selecting Properties.

  3. Select the Home Directory tab on the property sheet.

  4. In the Application Settings section, click the Configuration button.

  5. In the Application Configuration dialog box that appears, select the App Mappings tab.

  6. By default, the aspnet_isapi.dll file is mapped to the .aspx extension. If you click Edit, you can map aspnet_isapi.dll to any extension you choose. For example, if you map the extension to .asp files, all pages that end with the extension .asp will work as ASP.NET pages. (You need to delete the existing mapping for .asp files before you do this.)

After you complete the preceding steps, pages with an .asp extension will be processed by the ASP.NET engine. However, you have to complete one more series of steps before they will function correctly as ASP.NET pages:

  1. Open the machine.config file for your Web server with Notepad. The machine.config file is located under the WINNT\Microsoft.NET\Framework\_[ version ]\CONFIG directory.

  2. Find the <httpHandlers> section. This section lists handlers for files with different extensions, such as .aspx , .asmx , and .asp .

  3. Change the handler used for .asp files to System.Web.UI.PageHandlerFactory like this:

     
    [View full width]
     
    [View full width]
    <add verb="*" path="*.asp" type="System.Web.UI.PageHandlerFactory, System.Web, Version=1.0.2411.0, Culture=neutral, graphics/ccc.gif PublicKeyToken=b03f5f7f11d50a3a" />

These last three steps are necessary to associate .asp files with the correct handler. If you neglect to complete these steps, you receive an error message when attempting to open an .asp file.



ASP.NET Unleashed
ASP.NET 4 Unleashed
ISBN: 0672331128
EAN: 2147483647
Year: 2003
Pages: 263

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