c# - Routing the right way in .NET MVC4 -


i'm developing admin panel , have created new area called "admin" start. in adminarearegistration.cs file routing this

context.maproute(     "admin_default",     "admin/{controller}/{action}/{id}",      new { controller = "index", action = "index", id = urlparameter.optional } ); 

so can reach admin panel http://{mydomain}/admin/

and have 2 controllers. indexcontroller manage login, signin, etc. usercontroller manage listing users, adding new user, etc.

when try access user's list url http://{mydomain}/admin/user/list/ pretty looking url. when try access signin new admin url this: http://{mydomain}/admin/index/signin/

but didn't 2nd url. can access index controller http://{mydomain}/admin/signin/ , others first one.

and how approach kind of situation? want in right way

for signin url, if have signin action set-up in indexcontroller, set-up route before "admin_default" route this:

context.maproute(     "admin_signin",     "admin/signin",      new { controller = "index", action = "signin" } ); 

you can link action actionlinks so:

@html.actionlink("sign-in here", "signin", new { controller = "index", action = "signin" }) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -