Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ASP.NET pages exhibit unexpected behavior because the server-side code is not processed


View products that this article applies to.

Symptoms

Symptoms that are exhibited at run time

When you view an .aspx page in a Microsoft ASP.NET Web application, you may experience the following symptoms:
  • A blank page may appear in the browser.
  • You may receive an instruction to download the .aspx page.
The typical behavior is that the server-side code for the .aspx page is processed, and then the code is not sent to the Web browser in its raw form.

Symptoms that are exhibited when you use Visual Studio .NET to debug ASP.NET

When you debug an ASP.NET application in Microsoft Visual Studio .NET, you may receive the following error message in the IDE:
Error while trying to run project: Unable to start debugging on the Web server. The server does not support debugging of ASP.NET or ATL Server applications. Run setup to install the Visual Studio .NET server components. If setup has been run, verify that a valid URL has been specified.

You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation. Would you like to disable future attempts to debug ASP.NET pages for this project?

↑ Back to the top


Cause

After you install the Microsoft .NET Framework Software Development Kit (SDK) or Microsoft Visual Studio .NET, Microsoft Internet Information Services (IIS) mappings are created to associate new file name extensions and new settings for ASP.NET.

The new settings are not in place if either of the following statements applies to your situation:
  • IIS was not installed when you ran the .NET Framework SDK or Visual Studio .NET Setup.
  • You removed and then reinstalled IIS after you ran the .NET Framework SDK Setup or the Visual Studio .NET Setup.

↑ Back to the top


Resolution

To resolve this issue, repair the IIS mappings so that the file name extensions for ASP.NET are properly associated. There are two ways to fix IIS mappings for ASP.NET.

To repair IIS mappings for ASP.NET, run the Aspnet_regiis.exe utlity. To do so, follow these steps:
  1. Click Start, and then click Run.
  2. Type cmd, and then click OK.
  3. At the command prompt, type the following command, and then press ENTER:
    "\WindowsFolder\Microsoft.NET\Framework\VersionNumber>\aspnet_regiis.exe" -i
    Note Replace WindowsFolder with the name of the directory where the operating system is installed. Replace VersionNumber with the .NET Framework version installed on your computer.
To repair IIS mappings for ASP.NET, you must register Aspnet_isapi.dll. To do so, follow these steps:
  1. Click Start, and then click Run.
  2. Type regsvr32 WindowsFolder\Microsoft.NET\Framework\VersionNumber\aspnet_isapi.dll, and then click OK. Regsvr32 returns the results of the registration.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to reproduce the behavior

Follow these steps to verify whether or not you see the issue described in this article. This test checks for the typical symptoms that are related to the issue. If you are already familiar with how IIS application mappings work, you can also follow the steps in the "How To Verify Your IIS Application Mappings" section of this article to verify the configuration of your Web server.
  1. To create an ASP.NET Web application, use Visual Studio .NET. To do so, follow these steps:
    1. Start Microsoft Visual Studio .NET.
    2. On the File menu, point to New, and then click Project.
    3. In the New Project dialog box, click either Visual C# Projects or Visual Basic Projects under Project Types, and then click ASP.NET Web Application under Templates.
    4. In the Location box, replace the WebApplication# default name with MyWebApp. If you use the local server, you can leave the server name as http://localhost. The resulting Location box appears as follows:
      http://localhost/MyWebApp
  2. In Solution Explorer right-click the project node, point to Add, and then click Add Web Form. Name the Web Form MappingsTest.aspx, and then click Open.
  3. Right-click the .aspx page in the editor, and then click View Code. Add the following code to the Page_Load event handler:

    Visual C# .NET
    private void Page_Load(object sender, System.EventArgs e)
    {
    	Response.Write("This code was executed");
    }
    						
    Visual Basic .NET
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Response.Write("This code was executed")
    End Sub
    					
  4. On the File menu, click Save All to save the Web Form and other associated project files.
  5. On the Build menu in the Visual Studio .NET IDE, click Build Solution.
  6. Right-click the .aspx page, and then click View in Browser.
  7. If the mappings are correct, the "This code was executed" message appears in the browser. If the mappings are not correct, one of the following behaviors occurs:
    • A blank page appears in the browser.
    • You receive a prompt to download the .aspx page.
    This behavior occurs because server-side code is not processed or executed in the expected manner. In either case you receive the unprocessed source code. For the blank page scenario, if you right-click the page in the browser and then click View Source, you notice that the server-side code appears in its unprocessed form. For example, in a Visual C# ASP.NET Web Form, the @ Page directive appears similar to the following:
    <%@ Page language="c#" Codebehind="MappingsTest.aspx.cs" AutoEventWireup="false" Inherits="MyWebApp.MappingsTest" %>
    					

How to verify your IIS application mappings

To verify that the application mappings are correct, follow these steps:
  1. Click Start, point to Programs, point to Administrative Tools, and then click Internet Services Manager.
  2. Expand the node that corresponds to the local host (computer name), and then expand the Default Web Site node.
  3. Right-click your Web application directory, and then click Properties.
  4. On the Directory tab, under Application Settings, click Configuration.
  5. Click the App Mappings tab.
  6. On the App Mappings tab, under Application Mappings, check whether the .aspx extension is mapped to the following DLL:
    C:\WindowsFolder\Microsoft.Net\Framework\VersionNumber\aspnet_isapi.dll
    Note Replace WindowsFolder with the name of the directory where the operating system is installed. Replace VersionNumber with the .NET Framework version that is installed on your computer.
  7. If you cannot find the application mapping entry, follow the steps in the "Resolution" section of this article.

↑ Back to the top


References

The resolution to repair IIS mappings for ASP.NET is derived from Microsoft Knowledge Base article Q306005. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
306005 How to repair IIS mapping after you remove and reinstall IIS
The following article offers more in-depth information about the debugging scenario described previously in this document:
318465 Cannot debug ASP.NET Web application

↑ Back to the top


Keywords: kbsetup, kbprb, kbconfig, kbwebforms, kbdebug, KB325093

↑ Back to the top

Article Info
Article ID : 325093
Revision : 9
Created on : 12/3/2007
Published on : 12/3/2007
Exists online : False
Views : 734