title: The view 'Home' or its master was not found or no view engine supports the searched locations. The following locations were searched: 'sporadic error'
body: <p>I am getting sporadic errors when working with my MVC 4 application when trying to return a View. </p>
  
  <p>In this particular case, I am about to return a View <code>return View("Home", model);</code> and that's where I get the msg. It also seems to sporadically happen when you're constantly testing &amp; debugging and I think the View Engine goes bonkers. For instance, before this one, I was executing a simple view and said it couldn't find it when it was there all the time. After a combination of clearing cache, rebooting, etc, and executing the same exact logic, it worked.</p>
  
  <p>So, I don't know how to fix this issue with the View Engine. Right before I come back into the View, I can assure you that I have records in my model. I can't attach a screen print on this form from my pc --- no option for it.</p>
  
  <p>So, the dire question is: How do I solve this issue where it doesn't sporadically happen like this??? This is a serious problem and hope to get it fixed....</p>
  
  <p>I looked at Scott Hanselmans nuget package for precompiling views, etc, but seems overcomplicated and extra work. I was wondering if there is something else I can do.</p>
  
  <p>Any help would be much appreciated....</p>
  
  <p>Here is my Globla.asax file:</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
      routes.MapHttpRoute(
          name: "DefaultApi",
          routeTemplate: "api/{controller}/{id}",
          defaults: new { id = RouteParameter.Optional }
      );
  
      routes.MapRoute(
          name: "Default",
          url: "{controller}/{action}/{id}",
          defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
      );
  }
  </code></pre>
  
  <p>If someone can please answer, I would appreciate it as this would have our MVC apps that we are working on come to a halt!</p>
  
  <p>I tried adding the <code>.DataTokens.Add("area", "YOURAREANAME");</code> onto the end of the <code>MapRoute</code>, but I don't know what to substitute for the strings.</p>
  
  <p>In addition, I don't know why this needs to be done (if it will fix it) and need an explanation from someone... </p>
  
  <p>Added code for another person that wants to check out the controller code.</p>
  
  <pre><code>[HttpPost]
          public ActionResult Refresh(ViewModelTemplate_Guarantors model)
          {
              try
              {
                  model.Error = string.Empty;
  
                  bool dbHasRows = db.ChkLoanFields(Convert.ToInt32(model.LoanId));
  
                  if (!dbHasRows)
                  {
                      ViewBag.ShowTemps = false;
                      model.Error = "Details not available for this LoanId.";
                      return View("Home", model);
                  }
                  else
                  {
                      int TemplateCnt = 0;
                      int GuarantorCnt = 0;
                      ViewBag.ShowTemps = true;
  
                      ViewModelTemplate_Guarantors tg = db.SelectViewModelTemplate_Guarantors(Convert.ToInt32(model.LoanId), "1", model.SelectedDeptText, out TemplateCnt, out GuarantorCnt);
  
                      if (TemplateCnt &gt; 0)
                          model.Templates = tg.Templates;
                      else 
                         model.ErrorT = "Templates not available for this LoanType.";
  
                      if (GuarantorCnt &gt; 0)
                          model.Guarantors = tg.Guarantors;
                      else
                          model.ErrorG = "Guarantors not available for this LoanId.";
  
                      return View("Home", model);
                  }
              }
              catch (Exception ex)
              {
                  throw ex;
              }
          }
  </code></pre>
  
  <p>i DON'T UNDERSTAND WHY THE ROUTING engine tries to go to the following, when I my directory structure is clearly:
  Views/Home/Index.cshtml</p>
  
  <p>The error that is givien is below and doesn't even look for the "Index" page..</p>
  
  <pre><code>~/Views/Home/Home.aspx
  ~/Views/Home/Home.ascx
  ~/Views/Shared/Home.aspx
  ~/Views/Shared/Home.ascx
  ~/Views/Home/Home.cshtml
  ~/Views/Home/Home.vbhtml
  ~/Views/Shared/Home.cshtml
  ~/Views/Shared/Home.vbhtml
  </code></pre>