•  rich2020
  • 57.2% (Neutral)
  • YAF Camper Topic Starter
Hi all,

I'm working with an MVC 4 application and have intergrated the membership and what-not, but am having trouble with the master page. In MVC Razor, the master page is called "_Layout.cshtml" and on that page, the navigation, the css, JS... etc are all kept as a "core" of the site. This really works the same way as the ASP.NET master page.

What I've done is I've created a controller "Forums" and when the user hits the "Index" action, they are taken to a view (webpage) with an iframe.

This iframe loads in the YAF forums and all is well... until I navigate to my profile or some other part of YAF.

The reason for this is that because entering the forums via the /controller/action and then have the iframe load the forums causes the forum to be rendered within an iframe and allows the view behave as a master page.

However, when I navigate to another part of the forum, the initial /controller/action is lost and the forum loads as if it was being accesed simply via a regular URL EG. http://mysite/forums.

Has anyone here managed to get the forums working with an MVC razor master page? Does anyone have any suggestions for me?

It seems that when visiting anything outside of the regular forum - eg: My profile, My Albums... the URL gets reset. EG: http://localhost:100/YAFForums/ - here the forums work fine with the master page included... but when I navigate to My Profile: http://localhost:100/YAF/Forums/default.aspx?g=cp_profile

http://localhost:100/YAF/Forums/ is the real location and http://localhost:100/YAFForums/ is being routed via the controller.

Many thanks!
I'm not quite sure if this will help you considering he's using MVC5; however, maybe some ideas on here will help you in figuring out a solution to your problem. The article author Dino Esposito talks about mixing webforms with MVC so it's worth a shot. 
I ended up modifying the master page of the forum so that it was just like the layout of the MVC portion of the site.

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