Page.aspx in the view folder in ASP project.MVC

Good Afternoon folks,

I am a beginner in MVC architecture and I am having a doubt in an ASPNET project.MVC. I would like to know if it is possible in The "View" folder of the project, to place an "aspx" page along with the "cshtml"files.

If I put the file in the root of the web application, it goes up quietly but when I put it in the view folder it generates the Error 404.

I searched for some solutions on the web but didn't find much.

Now thank you,

Thank you!

Author: RogerPS, 2018-07-27

1 answers

In case of a migration I recommend that you create a folder called "legacy" or as" Paginas "even (in case you do not want to leave this intention explicit" and add the Ignore this route in your RouteConfig which is located in the directory App_Start. So MVC will bypass this route in its management.

See the example below

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");            

        routes.IgnoreRoute("{diretorio}", new { diretorio = "Paginas" });

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
}
 2
Author: Leandro Angelo, 2018-07-27 20:56:44