paulc
  •  paulc
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2013-05-05T10:35:24Z
Hi

I have been trying to integrate YAF into an mvc web application. I have created an mvc4 website template and added YAF to a sub folder. This runs ok from the default.aspx that comes with the forum. When i try to create an mvc content page using an aspx master page I get problems relating to the CSS classes.

if <link href="../../Content/Site.css" rel="stylesheet" /> or Styles.Render("~/Content/css") is included in the master page then the YAF CSS throws an 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) +9600971
YAF.Core.Services.PageElementRegister.RegisterCssInclude(Control element, String cssUrl) +116
YAF.Core.Services.PageElementRegister.RegisterCssIncludeResource(String cssUrlResource) +110
YAF.Modules.PopupDialogNotification.OnPreRender(EventArgs e) +391
System.Web.UI.Control.PreRenderRecursiveInternal() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974


Ive looked into this but cant work out why this is happening. does anybody know why this is or how to get around this? If not is there another way to use YAF inside an mvs master page or layout.cshtml?


Thanks

Paul

Sponsor
JP
  •  JP
  • 100% (Exalted)
  • YAF Leader
2013-05-05T18:09:00Z
I've also tried... I am doing an MVC4 site with Razor views, but have not found a way to implement YAF fully into that... So I have resigned to using the YAF default.aspx with the header & footer html code from the _layout.cshtml...

I do however use the YAF Membership for the MVC4 site too...
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Old Chinese Proverb]
paulc
  •  paulc
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2013-05-06T18:18:30Z
hi

i found out this was because of the header section :
http://stackoverflow.com...ontrol-contains-code-blo 

i created a new project using an aspx master page and tried the workaround above and it worked. i havent tried in razor though.

how did you get the membership to work? i cant get it to work as mvc uses webmatrix.extendedMembershipProvidor instead of the Membership provider
Zero2Cool
2013-05-29T12:48:05Z
I modified the ASP.NET Sample Application for my site with a page that displays YAF, but would much prefer to use MVC and Razor as well.
Users browsing this topic

    About Us

    The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

    Powered by Resharper Donate with PayPal button

    Project Twitter Updates

    Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved