asp.net mvc - Resource Could Not Be Found -
i creating website in asp.net mvc3. problem getting "resource not found" error when file referenced appears in right location.
this exact error message:
server error in '/' application. resource cannot found. description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review next url , create sure spelled correctly. requested url: /views/product/index.cshtml
the thing is, there index.cshtml in /views/product.
this excerpt global.asax:
routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "product", action = "index", id = urlparameter.optional } // parameter defaults );
resolution: issue had set index.cshtml "start page" right clicking , choosing "set start page". after typing url manually per nemesv's suggestion , seeing worked, went project settings , changed web->start action "current page".
you requested /views/product/index.cshtml
, wrong. must create productcontroller
class index
method:
public class productcontroller : controller { public void index() { homecoming view(); } }
and request localhost:yourport/
index product controller defined in routes (or /product/index
).
asp.net-mvc asp.net-mvc-3
No comments:
Post a Comment