hi all,,,,
I have one doubt on asp.net mvc 3 routing..Iam doing a project in mvc3.In my application there is an admin side and also public user side..
I have a controller that is adminController to login the admin..In the adminController there is two action methods for login and home.So the url look like
www.mySite.com/admin/login
www.mySite.com/admin/home
I have created another folder Admin in the controller folder only for accessing administrators and created ManageMembersController in the Admin folder..and the url should look like
www.mySite.com/admin/ManageMembers/list
I have written the custom routing in the global asax file..
routes.MapRoute(
"Admin",
"Admin/{controller}/{action}/{data}",
new
{
controller = "/Admin/ManageMembers",
action = "list",
data = UrlParameter.Optional
}
);
routes.MapRoute(
"admin_default",
"admin/{action}/{id}",
new { controller = "admin", action = "login", id = UrlParameter.Optional }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Pub", action = "Index", id = UrlParameter.Optional }
);
My problem is that when iam trying to www.mySite.com/admin/login I got an error
'The resource cannot be found.'
but the other routing worked properly..
that is www.mySite.com/admin/ManageMembers/list it redirected to the ManageMembersController
My requirement is to redirect to Controller/adminController.cs when the url is www.mysite.com/admin/..
and it must redirect to Controller/Admin/ManageMembers.cs when the url is www.mySite.com/Admin/ManageMembers/..
I need your suggestions...
Thank you Devguys...