I'm using ASP.NET MVC 5.2.2.0 (C#) within Webform.
When I follow this step: right click solution -> Add -> New item... -> create new webform
After debugging, that's work without a problem when I type "localhost/webform1.aspx" on url.
But, when I do this: right click Views\Home folder -> Add -> Web form -> ok
In HomeController.cs
public ActionResult Test()
{
return View("webform2");
}
In RouteConfig.cs
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{WebForm}.aspx/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
It gave to me an error when I type "localhost/home/test" on url:
The view at '~/Views/home/webform2.aspx must derive from ViewPage, ViewPage<TModel>...'
My question is: Can't webform be created in Views\Home folder?
If possible, can you tell me how to do that?
Thank you!