Doubt with Microsoft .NET Framework version asp.net mvc

0

Doubt, am I using the wrong version? The image shows the Version Information: Microsoft .NET Framework Version: 4.0.30319; ASP.NET Version: 4.0.30319.34274

On my hosting server informs this:

ASP, Asp.NET 3.5, Asp.NET 4.0, Asp.NET 4.5 Ajax Extensions for Asp.NET HTML, CSS, XML and JavaScript MVC3, MVC4, MVC5 Plesk Control Panel in Portuguese Flash, WML and WAP support

After uploading a site made in ASP.NET MVC, I get an error message: 403 - Forbidden: Access is denied.

So I made a site with only 1 controller and generated the view, I added it in web.config:  

To show me the error and upload the files to the main httpdocs directory, I now get an error message:

Norouteislikethis:

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace WebSiteTeste { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }

No Controller:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebSiteTeste.Controllers
{
    public class DefaultController : Controller
    {
        // GET: Default
        public ActionResult Index()
        {
            return View();
        }
    }
}

no index:

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

In web config:

  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <customErrors mode="Off"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
    
asked by anonymous 08.01.2016 / 01:14

1 answer

1

Very simple. You are calling the Home controller in your RouteConfig , but the name of your controller is DefaultController .

Just change the name of your controller or the name in your RouteConfig .

 public class HomeController : Controller

or

 routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Default", action = "Index", id = UrlParameter.Optional }
            );
  

In the form of your code your application does not find the controller, so the error 404 (not found).

    
08.01.2016 / 14:40