c# - Why can't I put the webform into Views/Home folder? -
i'm using asp.net mvc 5.2.2.0 (c#) within webform.
when follow step: right click solution -> add -> new item... -> create new webform
after debugging, that's work without problem when type "localhost/webform1.aspx" on url.
but, when 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 me error when type "localhost/home/test" on url:
the view @ '~/views/home/webform2.aspx must derive viewpage, viewpage<tmodel>...' my question is: can't webform created in views\home folder?
if possible, can tell me how that?
thank you!
by default views folder have web.config file blocks access items in folder below.
fix:
- update views\web.config allow access covered in placing js files in views folder
- put web forms own folder
Comments
Post a Comment