I am having a problem where I try to open my ASP.NET MVC application but I get the ASP.NET error page which says this:
Server Error in \'/\' Applicati
I got the same error while building a MVC application.
In my case it happened because I forgot to add the string "Controller" in my controller name.
public class ProductType : BaseController
{
public ProductType()
{
}
}
public class ProductTypeController : BaseController
{
public ProductTypeController ()
{
}
}
I found the solution for this problem, you don't have to delete the global.asax, as it contains some valuable info for your proyect to run smoothly, instead have a look at your controller's name, in my case, my controller was named something as MyController.cs and in the global.asax it's trying to reference a Home Controller.
Look for this lines in the global asax
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
in my case i had to get like this to work
new { controller = "My", action = "Index", id = UrlParameter.Optional }
Open your Controller.cs file and near your public ActionResult Index(), in place of Index write the name of your page you want to run in the browser. For me it was public ActionResult Login().