Microsoft Knowledge Base Email Alertz

KBAlertz.com: 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:

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 315990 - Last Review: February 23, 2007 - Revision: 2.4

BUG: "Expected Identifier" Error Message on Default.aspx ASP.NET Page

This article was previously published under Q315990

On This Page

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:
  1. Open Default.aspx in Visual Studio .NET designer.
  2. Click the HTML tab to view the HTML code.
  3. 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">
    					

STATUS

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

MORE INFORMATION

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.

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
Keywords: 
kbbug kbideproject kbnofix kbservercontrols kbwebforms KB315990
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please