0

I have a problem updating an old application that uses Spring.Net. To not have to mess with Spring.Net I've created an area and isolated it to use the DefaultControllerFactory described here.

This works just fine and my Controller loads as I would expect it to, but it is loading the view from the main project and not my area view.

Relevant Project Structure is:

/Areas/App/Controllers/HomeController.cs

/Areas/App/Views/Home/Index.cshtml

/Controllers/HomeController.cs

/Views/Home/Index.aspx

Controller:

namespace Portal.Web.Areas.App.Controllers
{
    public class HomeController : Controller
    {
        // GET: /App/Home/
        public ActionResult Index()
        {
           return View("Index");
        }
    }
}

View:

@{
  Layout = null;
}
<h2>appindex</h2>

If I try to load a view that does not exist like "blubber" it shows the order of folders in which it is searching. This shows my areas folder first. But if the view exists it doesn't load first from this folder.

What is wrong here..., is Spring.Net still mixing stuff or is it plain MVC stuff going wrong?

Community
  • 1
  • 1
spankmaster79
  • 21,555
  • 10
  • 42
  • 73
  • does the controller is hitted? can you breakpoint it and be sure of that? – clement Dec 10 '14 at 14:35
  • yeah I can breakpoint it and if I name the view different from index it loads just fine – spankmaster79 Dec 10 '14 at 14:38
  • just wondering, could it be that even though the area folder contains the .cshtml MVC prefers to load .aspx over .cshtml ??? – spankmaster79 Dec 10 '14 at 14:56
  • all must be OK, I don't know spring so I can't help you for that. Could you try simply to return View(); ? very strange issue – clement Dec 10 '14 at 14:59
  • same behaviour, but if I add an Index.aspx this get's loaded. So it seems like it goes through all paths for .aspx first and then for .cshtml. So it does prefer ASPX over Razor and if it finds one it uses it.... strange – spankmaster79 Dec 10 '14 at 15:13

0 Answers0