asp.net mvc - Asp MVC Routing not working Properly -
i'm new mvc framework; i'm trying learn.
i'm trying redirect login home page
[httppost] public actionresult login(register model) { studentdbhandle db = new studentdbhandle(); datatable dst = db.login(model); if (dst.rows.count==1) return redirecttoaction("index","student"); else { viewbag.message = "login failed"; return view(); } }
it says "no route in route table matches supplied values."
so added route in routeconfig file
public static void registerroutes(routecollection routes { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "login", url: "{controller}", defaults: new { controller = "register", action = "login", id = urlparameter.optional } ); routes.maproute( name: "homepage", url: "{controller}/{action}/{id}", defaults: new { controller = "student", action = "index", id = urlparameter.optional } ); }
when login succeeds, redirects same login page
i have changed order, it's not working.
Comments
Post a Comment