I have an controller called "AuditoriaController" and at the _Layout.vbhtml I have a action link to this controller:
<li>@Html.ActionLink("Auditoria", "Index", "Auditoria")</li>
When I click at this link at the view I have this error message:
Server Error in '/' Application.
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.
Requested URL: /Auditoria/
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
At the AuditoriaController I have this code:
Public Class AuditoriaController
Inherits System.Web.Mvc.Controller
'
' GET: /Auditoria
Function Index() As ActionResult
Return View(AuditoriaDB.GetAllItems())
End Function
End Class
Here is my Routes at the RouteConfig.vb
Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute( _
name:="Default", _
url:="{controller}/{action}/{id}", _
defaults:=New With {.controller = "EscalaPrevisao", .action = "Index", .id = UrlParameter.Optional} _
)
End Sub
With other controllers not happen this problem. If I use this url: localhost:4802/Auditoria/Index the error does not happen.
Can anyone help me?
A 404 is returned when the controller class name is not what is expected.
Rename the "Home" default class to "Home1" and you'll see the exact same error. Validate there are no typos... It's almost guaranteed to be that.