Does the View exist in one of the places listed in the error?
What is the inherant path set to?
Yes, the view exists. The strcutrue looks like:
C:\EPISERVER\SITES\SITEDIR\MODULES\MYADDON
├───bin
│ └───net40
│ ├───de
│ ├───es
│ └───fr
├───Content
└───Views
├───BaseBlock
└───BasePage
The view is located in the BasePage directory. Was also located there when it was working. I also tried specifiying the path by myself and got the same error message with the correct full patch to the view. So it definitly exists at the right location!
return View(Paths.ToResource(this.GetType(),"Views/index.cshtml"), model);
I don't have a web.config in the MYADDON directory and also not in the Views directory. So everything should be configured out of the box. Or should I have somewhere a web.config file? If yes, why it was working once without a web.config file?
In addition, if I right click in visual studio the controllers Index method and select "Go to View" the right view opens.
What does your control look like? . Do you have view for the index action or are you redirecting the index action to your action?
From the code you posted you seem to be returning BasePage.cshtml but MVC is looking for /Vies/BasePage/index.cshtml
public class BasePageController : PageControllerBase<BasePage>
{
private static readonly ILog logger =
LogManager.GetLogger(typeof(BasePageController));
[ContentOutputCache]
public ActionResult Index(BasePage currentPage)
{
if (logger.IsDebugEnabled)
logger.Debug("Index - START");
var model = new BasePageModel();
if (currentPage != null)
{
model.Heading = currentPage.Heading;
model.Body = currentPage.MainBody;
model.MyBlock = currentPage.MyBlock;
var editingHints = ViewData.GetEditHints<BasePageModel, BasePage>();
editingHints.AddConnection(x => x.Body, x => x.MainBody);
}
else
{
if (logger.IsDebugEnabled)
logger.Debug("Index - NULL currentPage");
}
if (logger.IsDebugEnabled)
logger.Debug("Index - DONE");
return View(model);
}
}
The view 'index' or its master was not found or no view engine supports the searched locations. Maybe the problem is related to masterpage?
Do you have the same problem when using this way?
return View(Paths.ToResource(this.GetType(),"Views/BasePage.cshtml"), model);
Sometimes you need to add config file in your add-on vierws folder to let razor engine know about your model. I blogged about similar thing here, please see "MVC block rendering" section. It was about EPiServer 7 Preview, but most of it should be accurate.
If I read your file structure correctly, the BasePage and BaseBlock are folders, not views.
If Dmytro's suggestion doesn't work, you should try:
return View(Paths.ToResource(this.GetType(),"Views/BasePage/index.cshtml"), model);
If I read your file structure correctly, the BasePage and BaseBlock are folders, not views.
If Dmytro's suggestion doesn't work, you should try:
return View(Paths.ToResource(this.GetType(),"Views/BasePage/index.cshtml"), model);
Hello all. Problem was related to the inherited class. Because I don't have a web.config, I need to inherit the view from System.Web.Mvc.WebViewPage. Here is the statement:
@inherits System.Web.Mvc.WebViewPage<Namespace.Models.BasePageModel>
Now I have the problem that my model namespace could not be found.
Compiler Error Message: CS0246: The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
So I've added a small web.config to add my dll:
<configuration>
<system.web>
<compilation>
<assemblies>
<add assembly="Namespace.CMS.BaseLayout" />
</assemblies>
</compilation>
</system.web>
</configuration>
May now I get:
So not working without a web.config and not working with a web.config.
Hi, Konrad,
Any updates regarding your issue? It seems that i'm receiving the same error.
Regarding error "The controller for path '/admin/internal/UI/CMS/en/BBB,,16_21/' was not found or does not implement IController.":
It looks like this is a bug, you can find more information here.
You can try following workaround: add your assembly in system.web/compilation/assemblies section in web.config manually:
<configuration>
…
<system.web>
<compilation … >
<assemblies>
…
<add assembly="Your.Assembly.Name" />
</assemblies>
</compilation>
</system.web>
</configuration>
Created an Add-On. A block type out of that Add-On just working well. A page type out of the same Add-On gives the error below. The view exists. It was working once. Don't know what I've changed. Any idea?
Server Error in '/' Application.
The view 'index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/BasePage/index.aspx
~/Views/BasePage/index.ascx
~/Views/Shared/index.aspx
~/Views/Shared/index.ascx
~/Views/BasePage/index.cshtml
~/Views/BasePage/index.vbhtml
~/Views/Shared/index.cshtml
~/Views/Shared/index.vbhtml