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:


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -