The image of a login page (clickable image):
Is it seems (though the debug viewer), the ViewEngines
are both (razor+webforms, im using the first) there, in the ViewEngines
collection, and them both can find the views (manually) and display them, also tried manually.
So why is that they cannot do it on their own? This is simply an action method, nothing more:
public ViewResult Login()
{
return View();
}
Major Update
I have overridden the OnResultExecuting
method:
protected override void OnResultExecuting(ResultExecutingContext filterContext)
{
if (filterContext.Result is ViewResult)
{
if (((ViewResult)filterContext.Result).ViewEngineCollection.Count == 0)
{
((ViewResult)filterContext.Result).ViewEngineCollection.Add(new RazorViewEngine());
}
}
base.OnResultExecuting(filterContext);
}
And it turned out that every time and every view I do now need to add new IViewEngine
to a ViewResult
. Now why is that so? Even if the ViewEngines.Engines
collection is not empty?
Minor update.
The ViewEngineCollection
stopped being empty at some point of idling.
The
ViewEngineCollection
stopped being empty at some point of idling.This only might refer to some ASP.NET caching of old assemblies which was not for some reason updated by the new ones. This happens from time to time, and I have to clear the cache in order for some new code to work.