How to troubleshoot "The server tag is not well formed. " error on sharepoint?
I'm trying to edit a legacy wss3 sharepoint site.
Messing around with a 700+ code lines aspx page I got a "The server tag is not well formed." error on sharepoint and The ?content=1 trick does not work.
Anyone has a tip on how to get to the line that's causing the problem? I'm expecting something like the aspnet ysod, at least that's usefull.
If it's worth something, I have access to the actual server.
Update: I know the error is because I screwed up the markup, as ArenB kindly points out. What I would like to get to, is to a hint on where on the 700 li开发者_如何转开发nes is the mistake.
Update 2: I found a workarround and posted it as an answer, but the question is still open waiting for someone to give an answer on how to get a more descriptive error message.
Doing ctrl+k,d
on the page in Visual Studio should give you an approximation of where the error is. The shortcut attempts to format the aspx page for you, and if it fails to format, it tells you why by pointing you to the line where it found something problematic.
I fixed my issue thanks to @Aren's answer. My xml was fine, well almost. You can't use "..."
inside " "
. You have to switch to '
.
I wrote:
<asp:Repeater ID="LeadersBlock" runat="server" Visible="false">
<ItemTemplate>
<asp:Literal Text="<%# Eval("Employee") %>" />
</ItemTemplate>
</asp:Repeater>
instead of:
<asp:Repeater ID="LeadersBlock" runat="server" Visible="false">
<ItemTemplate>
<asp:Literal Text='<%# Eval("Employee") %>' />
</ItemTemplate>
</asp:Repeater>
I hope it can save someone else time.
Server Tag is not well formed means you've got a bad tag. I.e:
<asp:Label id="myLabel" runat="server"
Stuff!
</asp:Label>
Notice the missing >
in the top part of the tag
The other way this could happen is if you meant to make a terminated tag <tag />
but forgot the /
which leaves you with a missing end tag.
- As for locating the line, use a diff mechanism to see the lines you modified and try to pinpoint the bad tag.
- Or you could run an xml validator on the code, although asp may get quirky with a vanilla xml validator.
Ok, I figured out a manual way that may be useful to somebody, but it's not ideal either.
First, grab the code of the aspx page and paste it on another file (as a backup).
Then, remove WebPart
by WebPart
, then WebPartZones
and then any other possible server-side markup until the page stops breaking.
This way, you will at least know where the error is located.
For me, this time, was a WebPartZone
which had two attributes together, with no spaces in betweeen. This kind of errors can be very tricky.
I'm never doing this crazy barbarian hacking on a aspx sharepoint page again.
精彩评论