2

I have a solution, and it contains two projects. They are both MVC 3 projects.

Project A is the default (start up) one.

Project B is the second one.

They both have controllers and views.

Example:

Project A has something like /Home/Index

Project B has something like /Admin/Login

The question is how to write the mapping? When I type in the URL of /Admin/Login, I would like to see the page. Currently I have 404 error.

halfer
  • 19,824
  • 17
  • 99
  • 186
HorseKing
  • 454
  • 6
  • 19

2 Answers2

1

1) Let the normal routing be there in your global.asax and you can have a controller called "AdminController" to do all your admin tasks.

2) Create an Area Called "Admin and have your relevant controllers and views there.

Your default items(Non admin features) can stay in the root level controllers/views.

I would prefer to do the second option of area because it would keep my project clean as it grows. I would like to do a logical seperation of files.

Shyju
  • 214,206
  • 104
  • 411
  • 497
1

I sense that you wish to include /admin from project B into project A. Have a look at this: How to reuse Areas, Controllers, Views, Models, Routes in multiple apps or websites

Community
  • 1
  • 1
Valamas
  • 24,169
  • 25
  • 107
  • 177
  • So basically, the suggestion is create area, instead of create a whole new project? – HorseKing Apr 16 '12 at 01:16
  • You mention that You have Admin in another project. The only way to access Admin from a deployment of Project A is what i suggest above (areas or not). You only need Areas if you wish to have deeper urls. E.g. /Admin/News/{action}/{id}. – Valamas Apr 16 '12 at 01:25