473,756 Members | 8,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

{"Parser Error: The Runat attribute must have the value Server." }

I'm getting a {"Parser Error: The Runat attribute must have the value
Server." } error when I try to get the Server.GetlastE rror() in the
Global.asax codebehind.

Why am I getting this?

I tried to remove the code-behind and add the <script language="C#"
runat="server"> but that fails as well.

The code is simply:
protected void Application_Err or( object src, EventArgs e )
{
Exception exc = Server.GetLastE rror(); // fails here
Trace.Write (exc.Message.To String());
}

I've found nothing anywhere on this.

Thanks for your help

--Andy
Nov 19 '05 #1
3 6044
Hi Andy,

The error is probably on the .aspx page or .ascx.

Here is a code snippet that will give this exact error:

<body>
<form id="Form1" method="post" runat="server">
<asp:CheckBoxLi st id="CheckBoxLis t1" runat=""></asp:CheckBoxLis t>
</form>
</body>

Note that the runat attribute do NOT have server value. You can correct the
error by writing the as this:

<body MS_POSITIONING= "FlowLayout ">
<form id="Form1" method="post" runat="server">
<asp:CheckBoxLi st id="CheckBoxLis t1"
runat="server"> </asp:CheckBoxLis t>
</form>
</body>

--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada
"ADavidson" <AD*******@disc ussions.microso ft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
I'm getting a {"Parser Error: The Runat attribute must have the value
Server." } error when I try to get the Server.GetlastE rror() in the
Global.asax codebehind.

Why am I getting this?

I tried to remove the code-behind and add the <script language="C#"
runat="server"> but that fails as well.

The code is simply:
protected void Application_Err or( object src, EventArgs e )
{
Exception exc = Server.GetLastE rror(); // fails here
Trace.Write (exc.Message.To String());
}

I've found nothing anywhere on this.

Thanks for your help

--Andy

Nov 19 '05 #2
Try this :

protected void Application_Err or(Object sender, EventArgs e)
{
ExceptionHandle r.LogException exc = new ExceptionHandle r.LogException( );
exc.HandleExcep tion(Server.Get LastError().Get BaseException() );
//whatever you want to do here...
}

See Peter Bromberg's excellent article :
"Build a Really Useful ASP.NET Exception Engine"
at http://www.eggheadcafe.com/articles/20030816.asp


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"ADavidson" <AD*******@disc ussions.microso ft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
I'm getting a {"Parser Error: The Runat attribute must have the value
Server." } error when I try to get the Server.GetlastE rror() in the
Global.asax codebehind.

Why am I getting this?

I tried to remove the code-behind and add the <script language="C#"
runat="server"> but that fails as well.

The code is simply:
protected void Application_Err or( object src, EventArgs e )
{
Exception exc = Server.GetLastE rror(); // fails here
Trace.Write (exc.Message.To String());
}

I've found nothing anywhere on this.

Thanks for your help

--Andy


Nov 19 '05 #3
Thanks for the responses i reviewed my code and found the answer.... I'm an
idiot and suffered a major brain cramp..

To test the catch of the error I mistyped a runat in the aspx code.. So
that was the 'error' I was getting, the correct error as it turns out...
Good to see that i doubt working code...

Thanks again for your efforts, and i'm sorry to waste your time.

-Andy

"Juan T. Llibre" wrote:
Try this :

protected void Application_Err or(Object sender, EventArgs e)
{
ExceptionHandle r.LogException exc = new ExceptionHandle r.LogException( );
exc.HandleExcep tion(Server.Get LastError().Get BaseException() );
//whatever you want to do here...
}

See Peter Bromberg's excellent article :
"Build a Really Useful ASP.NET Exception Engine"
at http://www.eggheadcafe.com/articles/20030816.asp


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"ADavidson" <AD*******@disc ussions.microso ft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
I'm getting a {"Parser Error: The Runat attribute must have the value
Server." } error when I try to get the Server.GetlastE rror() in the
Global.asax codebehind.

Why am I getting this?

I tried to remove the code-behind and add the <script language="C#"
runat="server"> but that fails as well.

The code is simply:
protected void Application_Err or( object src, EventArgs e )
{
Exception exc = Server.GetLastE rror(); // fails here
Trace.Write (exc.Message.To String());
}

I've found nothing anywhere on this.

Thanks for your help

--Andy


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6118
by: owen | last post by:
Generally speaking, what does it mean when I see a "button" with red text showing this message instead of the control I've dragged onto the web form in Design View.? (But the page works fine at runtime). Does it indicate a problem with References for example? Thanks Owen PS. replies cc'd by email appreciated. owen.southwood@mantix.com
12
4129
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport) {
0
6464
by: Martin Colmenares | last post by:
After I set my <%@ page ValidateRequest="false" %> , I still get the error illustrated below. The msdn mentioned something about filtering using the HTMLEncode. This is a snippet of the code that should display the result. </head> <body MS_POSITIONING="GridLayout" bgcolor="gainsboro"> <form id="Form1" method="post" runat="server"> <INPUT style="Z-INDEX: 101; LEFT: 248px; POSITION:absolute; TOP:184px" type="button" value=" OK "...
7
1589
by: Brad | last post by:
I'm placing a runat=server attribute on the <title> tag in my pages, so I can read/set the title text in code. The problem is that when I subsequently change the page in design view VS is removing the runat=server from the <title> tag. Unfortunately it does not do it all the time...maybe 50%. Brad
1
1737
by: jason | last post by:
I've seen a few posts on this issue, but no clear solutions. I have a mulitiline textbox inside a datagrid. I use TemplateColumn to define as multiline with 3 rows. I have other field types like drop downs that have no issue displaying last values in edit mode with seemingly more complicated code. when I attempt to find my textbox with
3
2994
by: filip.norrgard | last post by:
Hi All! I've been developing an ASP.Net 2.0 web application using the Visual Studio 2005 tools. Currently datagrids on a page are filled with data from a dataset (a .xsd file in the "project") that, in turn, gets the data from MySql server. Locally testing it on my PC (Windows XP SP2, FYI) it works and no errors appear. However, when I upload it to the webserver (Windows 2003 Web Edit. Server) I get the a parser error on the dataset...
3
3698
by: keithb | last post by:
Using a GridView, I get a "Specified cast is not valid" error when binding the Visible propery of a hyperlink control to a DataTable text field. The error goes away if I replace the data binding statement with "true" or "false". This code causes the error: <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("c2Hyperlink1Link") %>' Target="_blank"
23
5133
by: deathtospam | last post by:
A day or two ago, I wrote a quick ASPX page with a CS codebehind using Visual Studio .NET 2005 -- it worked, I saved it and closed the project. Today, I came back to the project, reopened the solution, and was greeted with the following error: ======================================================================== It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error...
6
5361
by: Bobby Edward | last post by:
Using ASP.NET 3.5 and MySQL (thru DevArt MyDirect.NET)... On the production server I get a "Parser Error" for every XSD dataset. It works perfect on my dev machine. But, on the production server I get the error. To troubleshoot the issue I went back to my dev machine and changed all the connectionstrings from localhost to the remote/production server db and made sure everything works fine. I then uploaded all the files to the...
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.