SitefinityViewEngine doesnt check if View exists

Posted by Community Admin on 04-Aug-2018 04:51

SitefinityViewEngine doesnt check if View exists

All Replies

Posted by Community Admin on 22-Aug-2014 00:00

I have observed that the SitefinityViewEngine.FindsView method does not check if a view file exists when returning a result.  

It formats the view path using the prescribed MVC folder (e.g. ~/Mvc/Views/Browse/Index.cshtml) and returns a view result but does not check if that file exists.

This is in contrast to SitefinityViewEngenine.FindPartialView that does check if the file exists.

When using multiple view engines it means that the SitefinityViewEngine can prevent other view engines that can FindView from returning a correct answer.  Each IViewEngine is called in order, first time using cache, second time bypassing cache.  SiteFinityViewEngine.FindView also ignores the useCache parameter, so it will return a view result on the first pass preventing other ViewEngines from returning a view result when use cache is false.

Can the SitefinityViewEngine be updated to check if a file exists for FindView or enable/disable FindView file checking.

Posted by Community Admin on 26-Aug-2014 00:00

Hello Gary,

Yes, this is correct, I have verified in our source and indeed there is a check in FindPartialView method:

public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache)
        
            if (controllerContext == null)
                throw new ArgumentNullException("controllerContext");
 
            var viewPath = this.GetPartialViewPath(controllerContext, partialViewName, null);
            if (string.IsNullOrEmpty(viewPath) || !this.FileExists(viewPath))
            
...

I will forward this to our dev team and I hope this get fixed in some of our future releases.

Here is the feedback item I have created: FindView method in SitefinityViewEngine does not check if the view file exists. I have updated your Telerik points accordingly.

Your feedback is much appreciated!

Regards,
Vassil Vassilev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 26-Aug-2014 00:00

Thanks Vassil.

This thread is closed