Microsoft KB Archive/315990

= BUG: &quot;Expected Identifier&quot; Error Message on Default.aspx ASP.NET Page =

Article ID: 315990

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.0
 * Microsoft ASP.NET 1.1
 * Microsoft Visual C# .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition

-



This article was previously published under Q315990



SYMPTOMS
When you browse to a WebForm that is named Default.aspx and was created with Microsoft Visual Studio .NET, you receive the following error message:

A Runtime Error has occurred.

Do you wish to Debug?

Line: 19

Error: Expected identifier

This error occurs when server controls that cause a PostBack are present in a WebForm that was created with the C# language.



CAUSE
The C# WebForm outputs illegal JavaScript to the client. The C# WebForm outputs an HTML form named &quot;default&quot; and then references that form with &quot;document.default&quot;.

For example:   var theForm = document.default; In JavaScript, &quot;document.default&quot; is an illegal usage of the keyword &quot;default&quot;. Therefore, the browser displays a run-time error.

This illegal code is generated by any control that performs a PostBack.



RESOLUTION
To work around this problem, rename the form in the Default.aspx WebForm by following these steps:  Open Default.aspx in Visual Studio .NET designer. Click the HTML tab to view the HTML code.  Change the following HTML code  to the following code:  

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Problem

 * 1) Open Microsoft Visual Studio .NET.
 * 2) On the File menu, point to New, and then click Project.
 * 3) In the New Project dialog box, click Visual C# Projects under Project Type, and then click ASP.NET Web Application under Templates.
 * 4) In the Location text box, type the project name as TestApplication by replacing the default WebApplication# name in the URL path.
 * 5) Add a LinkButton server control to WebForm1.aspx.
 * 6) On the File menu, click Save.
 * 7) On the Build menu, click Build Solution.
 * 8) In the Solution Explorer window, right-click WebForm1.aspx, and then click View in Browser.

Keywords: kbbug kbideproject kbnofix kbservercontrols kbwebforms KB315990

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.