Microsoft KB Archive/325093

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

Article ID: 325093

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Services 5.1
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q325093



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?



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.



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:  Click Start, and then click Run. Type cmd, and then click OK. At the command prompt, type the following command, and then press ENTER:

&quot;\ \Microsoft.NET\Framework\ >\aspnet_regiis.exe&quot; -i

Note Replace  with the name of the directory where the operating system is installed. Replace  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  \Microsoft.NET\Framework\ \aspnet_isapi.dll, and then click OK. Regsvr32 returns the results of the registration.



STATUS
This behavior is by design.



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 &quot;How To Verify Your IIS Application Mappings&quot; section of this article to verify the configuration of your Web server.  To create an ASP.NET Web application, use Visual Studio .NET. To do so, follow these steps:  Start Microsoft Visual Studio .NET.</li> On the File menu, point to New, and then click Project.</li> 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.</li> 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

</li></ol> </li> 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.</li>  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(&quot;This code was executed&quot;); } Visual Basic .NET Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.Write(&quot;This code was executed&quot;) End Sub </li> On the File menu, click Save All to save the Web Form and other associated project files.</li> On the Build menu in the Visual Studio .NET IDE, click Build Solution.</li> Right-click the .aspx page, and then click View in Browser.</li>  If the mappings are correct, the &quot;This code was executed&quot; message appears in the browser. If the mappings are not correct, one of the following behaviors occurs: <ul> A blank page appears in the browser.</li> You receive a prompt to download the .aspx page.</li></ul>

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=&quot;c#&quot; Codebehind=&quot;MappingsTest.aspx.cs&quot; AutoEventWireup=&quot;false&quot; Inherits=&quot;MyWebApp.MappingsTest&quot; %> </li></ol>

How to verify your IIS application mappings
To verify that the application mappings are correct, follow these steps:  Click Start, point to Programs, point to Administrative Tools, and then click Internet Services Manager.</li> Expand the node that corresponds to the local host (computer name), and then expand the Default Web Site node.</li> <li>Right-click your Web application directory, and then click Properties.</li> <li>On the Directory tab, under Application Settings, click Configuration.</li> <li>Click the App Mappings tab.</li> <li>On the App Mappings tab, under Application Mappings, check whether the .aspx extension is mapped to the following DLL:

C:\ \Microsoft.Net\Framework\ \aspnet_isapi.dll

Note Replace  with the name of the directory where the operating system is installed. Replace  with the .NET Framework version that is installed on your computer.</li> <li>If you cannot find the application mapping entry, follow the steps in the &quot;Resolution&quot; section of this article.</li></ol>

<div class="references_section">