albinoJimy / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
0 stars 0 forks source link

Problem running Northwind sample, Exception "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." #136

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get and install Northwind DB (had to find and use SQL 2000 version)
2. Modify NHibernate.config file in src\NorthwindSample\app\Northwind.Web
3. Set start up project to Northwind.Web
3. Build and run.

What is the expected output? No sure, hoped for main application page.

What do you see instead? Exception.

The Controls collection cannot be modified because the control contains
code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot
be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified
because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +8677431
   System.Web.Mvc.ViewPage.ReplaceHtmlTitle() +194
   System.Web.Mvc.ViewPage.OnLoad(EventArgs e) +45
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Version Information: Microsoft .NET Framework Version:2.0.50727.3603;
ASP.NET Version:2.0.50727.3082 

I've never run into this exception doing ASP.NET work and have no idea
where to start looking. I googled and found some info but it didn't help me
pinpoint or correct the problem.

What version of the product are you using? On what operating system?
WinXP SP2, SQL2005 Express SP3, S#arp Architecture 1.0 RTM

Please provide any additional information below.
Some sort of readme file with information in it (instead of empty files)
would be helpful, I had no idea at first where to set the DB connection
information, last time I used Hibernate was in 2006 in Java.

Original issue reported on code.google.com by rja...@gmail.com on 6 Nov 2009 at 3:47

GoogleCodeExporter commented 9 years ago
Never mind, I found the answer on your Google groups forum:

http://groups.google.com/group/sharp-architecture/browse_thread/thread/ff0e33a5e
df9aeb2/f8c69996ac0a44ca?lnk=gst&q=The+Controls+collection+cannot+be+modified+be
cause+the+control+contains+code+blocks+(i.e.+%3C%25+...+%25%3E).#f8c69996ac0a44c
a

You have to wrap a line in Site.Master with an asp.PlaceHolder tag:

    <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>

Google group discussion seems to indicate this is problem with older versions 
of MVC
(RC1) but I got the error running MVC 1.0.

Original comment by rja...@gmail.com on 6 Nov 2009 at 5:10