BUG: "Expected Identifier" Error Message on Default.aspx ASP.NET Page (315990)
The information in this article applies to:
- Microsoft ASP.NET (included with the .NET Framework) 1.0
- Microsoft ASP.NET (included with the .NET Framework 1.1)
- Microsoft Visual C# .NET (2002)
- Microsoft Visual C# .NET (2003)
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 "default" and then references that form with "document.default".
For example:
<form name="default" method="post" action="default.aspx" id="default">
<script language="javascript">
var theForm = document.default;
</script>
</form>
In JavaScript, "document.default" is an illegal usage of the keyword "default". 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
<form name="default" method="post" action="default.aspx" id="default">
to the following code:
<form name="defaultA" method="post" action="default.aspx" id="default">
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 3/26/2003 |
---|
Keywords: | kbbug kbIDEProject kbnofix kbServerControls kbWebForms KB315990 |
---|
|