I have a new MVC-2 project where I added the area 'member'. I created a controller named: 'profile'.
This works: http://localhost:1234/Profile (loads up the index() function)
This however doesn't: http://开发者_StackOverflow社区localhost:1234/Member/Profile (i get a 404 error)Am I missing something here?
There's no reason for this not working. From the default project template:
- Right click on the project Add -> Area :
Member - In
~/Areas/Member/ControllersaddProfileControllercontaining a defaultIndexaction - In
~/Areas/Member/Views/ProfileaddIndex.aspx - Run the application and navigate to
/member/profile=> it shows the newly added page
Can you check your Global.asax.cs file, see whether it has the following code in Application_Start
AreaRegistration.RegisterAllAreas();
If http://localhost:1234/Profile works, you might need to check the namespace of your ProfileController. It should be:
namespace YourProjectName.Areas.Member
加载中,请稍侯......
精彩评论