How to fix ASP.NET MVC Attribute Routing 403 - Forbidden error.
10.05.2020 04:36
#ASP.NET #MVC #MAPMVCATTRİBUTEROUTES
How to fix ASP.NET MVC Attribute Routing 403 - Forbidden error.
Although you have redirects running when you want to run the MapMvcAttributeRoutes () function on ASP.NET MVC, one or more of them may be annoying, the possible solution of the 403 error that appears below is confusing with the file permission settings via hosting or via iis.
403 - Forbidden: Access is denied.
Here is the way you should follow to solve this problem.
If you are RouteConfig.cs in the App_Start folder in your home directory, adding the line I mentioned below to the code block in it will solve the problem.
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapMvcAttributeRoutes(); routes.RouteExistingFiles = true; routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = UrlParameter.Optional } ); }