Note that there are some explanatory texts on larger screens.

plurals
  1. POInheritance from Controller in Asp.NET MVC 5
    primarykey
    data
    text
    <p>I created a generic controller class</p> <pre><code>namespace OxygenFramework.MvcController { public class MvcController&lt;TEntity&gt; : Controller where TEntity : class { public void UpdateModelState(TEntity t) { ... } } } </code></pre> <p>then I used it as below </p> <pre><code>namespace LeitnerMVC.Controllers { public class HomeController : MvcController&lt;Account&gt; { // // GET: /Home/ public ActionResult Index() { UpdateModelState(t); return View(); } } } </code></pre> <p>BUT when run mvc application page shows this error </p> <pre><code>The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. </code></pre> <p>after searched in web I found a way for solve it </p> <pre><code> void Application_Start(object sender, EventArgs e) { ControllerBuilder.Current.DefaultNamespaces.Add("OxygenFramework.MvcController"); } </code></pre> <p><strong>But above solution does not work for me !!! and shows Http 404 error again</strong></p> <p><strong>When use Controller instead of MvcController page shows without problem !!!</strong></p> <p>Can anyone help me ?</p> <p><strong>Update :</strong></p> <p>after many investigation I understand why this problem occurs but still I dont know how resolve that. WHEN I move source code of MvcController out of my framework assemby (OxygenFramework.MvcController) and move it into MVC project MvcController works but when I refrence MvcController from OxygenFramework assembly MVC shows 404 error !!! Now I know this problem occur because MvcController is into another assembly but I dont know how solve this problem </p> <p><strong>attention :</strong> only generic implimentation of MvcController is in OxygenFramework assembly and all of Controller is into the default Controllers folder</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload