Help! I'm getting the error: "The server block is not well formed."

  • Thread starter Thread starter LiveCycle
  • Start date Start date
L

LiveCycle

Hi,

I've got a longstanding project that's been working fine for about a year.
I was working on one of the pages, a simple download page. After making a
little tweak on the page, I tried to re-run the project and got the error:

The server block is not well formed. Page: FileDownload.aspx, line 23935.

Now, there are only about 50 lines on this page, so something's off. I've
tried rebooting. I've tried Rebuild Solution. I've deleted the page from
the entire project, rebooted, and tried Rebuild Solution. I've rebuilt the
project from VSS. I still get the same error.

Please help if you can!

Thanks, Jim
 
Server block typically refers to one of the registrations on a page such as
the Page directive
<%@ Page %>

Usually this error occurs when you enter a <%@ to denote a server directive,
but on the wrong type of code. For example, a Response.Write

<%@ Response.Write("hi"); %>

That would throw a server block error because the <%@ is incorrect in this
case, it should just be <% instead

Look at your .aspx page for such an error.
 
Hi Mark,

I realize that this is usually the cause, but it's not the problem in this
case. Again:
* It says the line the error occurs on is 23935, a non-existent line in the
page (or its code-behind)
* I deleted the file from the project, and I still get the error.

I should have mentioned this is VS.NET 2005, fully service-packed. I also
tried deleting everything from my Temporary ASP.NET Files folder (under the
v2.0.50727 folder), to no avail.

Thanks, Jim

P.S. just for grins, this is the entire HTML code from this page (all the
work is in the code-behind):
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="FileDownload.aspx.cs" Inherits="FileDownload" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Requested File Not Found</title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
 
Problem solved. Apparently, I'd dropped a page into the project
accidentally that was not a real ASPX page, and named it FileDownload.aspx
(I've been trying to deal with IE7's weird download problems, and it got
named this way). So it was in a subfolder somewhere. Anyway, I hope this
helps somebody else, for future reference...
 
Back
Top