System.Web.HttpUnhandledException in Northwind application

6 views
Skip to first unread message

rupert

unread,
Mar 18, 2009, 7:06:01 AM3/18/09
to S#arp Architecture
Hello, I've noticed an issue with the Northwind application in
SharpArchitecture 1.0 rc2 (SharpArchitecture_1.0.48.410_RC2) so I'm
posting the changes I needed to make to get it working here.

When you run the application you get a
System.Web.HttpUnhandledException
"The Controls collection cannot be modified because the control
contains code blocks (i.e. <% ... %>)."
within the Default.aspx Page_Load method.

This bug is described here:
http://haacked.com/archive/2009/01/27/controls-collection-cannot-be-modified-issue-with-asp.net-mvc-rc1.aspx

and the change I made to get it working was to update the <head> tag
in Site.Master to the following:

<head id="Head1" runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
<title>S#arp Architecture</title>
</asp:ContentPlaceHolder>
<asp:PlaceHolder runat="server" id="mainScripts">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<link href="<%= ResolveUrl("~") %>Content/Site.css"
rel="stylesheet" type="text/css" />
</asp:PlaceHolder>
</head>

Ie. put the meta tag and the css link into a PlaceHolder control

Rupert

Billy

unread,
Mar 19, 2009, 6:26:32 PM3/19/09
to S#arp Architecture
Hi Rupert,

This was certainly an issue with MVC RC 1, but was resolved in RC 2.
You may want to verify that you have RC 1 uninstalled and that all of
your assemblies have been updated to the latest.

Thanks!
Billy


On Mar 18, 5:06 am, rupert <rupert.ba...@gmail.com> wrote:
> Hello, I've noticed an issue with theNorthwindapplicationin
> SharpArchitecture 1.0 rc2 (SharpArchitecture_1.0.48.410_RC2) so I'm
> posting the changes I needed to make to get it working here.
>
> When you run theapplicationyou get aSystem.Web.HttpUnhandledException
> "The Controls collection cannot be modified because the control
> contains code blocks (i.e. <% ... %>)."
> within the Default.aspx Page_Load method.
>
> This bug is described here:http://haacked.com/archive/2009/01/27/controls-collection-cannot-be-m...
Reply all
Reply to author
Forward
0 new messages