+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / SitefinityViewEngine doesnt check if View exists

SitefinityViewEngine doesnt check if View exists

3 posts, 1 answered
  1. Gary
    Gary avatar
    3 posts
    Registered:
    17 Feb 2014
    22 Aug 2014
    Link to this post

    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.

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    26 Aug 2014
    Link to this post
    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
     
    Answered
  3. Gary
    Gary avatar
    3 posts
    Registered:
    17 Feb 2014
    26 Aug 2014 in reply to Vassil Vassilev
    Link to this post

    Thanks Vassil.

3 posts, 1 answered