Ampersand in Title Tag Throws Atlas Unknown Error

I ran into a strange problem today working with the July CTP (it probably in earlier CTPs as well).

I had a fairly simple Atlas page that uses update panels. The page would continually throw an "Unknown Error" alert box when the update panel is being updated. Curiously, the cause of the error turns out not to be due to the Atlas UpdatePanel controls I had on the page but because I had an ampersand (&) in the title tag. Changing the "&" sign to an "and" fixed it.

Here's a simplified repro of the bug.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<
script runat="server">
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text =
string.Format("Hello {0}, the time is {1}.", TextBox1.Text, DateTime.Now.ToLongTimeString());
    }
</script>

<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
    <title>Copy & Paste</title>
</
head>
<
body>
    <form id="form1" runat="server">
        <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering=true />
        <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" /><br />
                <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
            </ContentTemplate>
        </atlas:UpdatePanel>
    </form>
</
body>
</
html>

A quick search of the Atlas forums revealed that others already have ran into this problem before and the issue is more generic to special characters in the title tag. In addition to this bug, forum members Gavin and Luis Abreu have compiled an unofficial list of Atlas bugs as reported in the Atlas Forums. It's a good idea to go through this list to get a general feel about the reported bugs by Atlas forum members and things to avoid in the Atlas CTP until they are fixed.  Since these releases are Community Tech Previews, it's understandable that there are bugs in the framework.

Update: Hannes Preishuber suggests setting ValidateRequest="false" in the page directive as a solution.


posted on Thursday, August 03, 2006 10:02 AM by AlanL

Comments

# re: Ampersand in Title Tag Throws Atlas Error

Monday, August 07, 2006 8:00 AM by Alan Le
Using the html escape code &amp; works. Howevery other codes such as &nbsp;, &reg;, and &copy will not.

# re: Ampersand in Title Tag Throws Atlas Error

Monday, August 07, 2006 9:56 AM by Alan Le
another oddity is that when the &amp; html code does not work when it is used in the title property of a content page directive

# re: Ampersand in Title Tag Throws Atlas Error

Tuesday, August 08, 2006 12:41 AM by JetBrain
Thanks so much for this post, it really did help me much in solving my problem...

# re: parser error in server tag 'atlas:ScriptManager'.

Monday, August 14, 2006 6:25 AM by atlas
i want to solve parser error in server tag 'atlas:ScriptManager'.plz guide me.

# re: Ampersand in Title Tag Throws Atlas Error

Monday, August 14, 2006 10:00 AM by Alan Le
for general Atlas problems, I find that the best place to go to is the Atlas forums at http://forums.asp.net/default.aspx?GroupID=34