.NET MVC2 - My domain url not registering?

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 the index () function)
However, it doesn’t: http: // localhost: 1234 / Member / Profile (I get 404 error)

Did I miss something?

+3
source share
3 answers

No reason for this to work. From the default project template:

  • Right-click on the project Add → Area: Member
  • In ~/Areas/Member/Controllersadd ProfileControllercontaining Indexdefault action
  • ~/Areas/Member/Views/Profile Index.aspx
  • /member/profile = > ,
+1

Global.asax.cs, , Application_Start

AreaRegistration.RegisterAllAreas();
+1

If it http://localhost:1234/Profileworks, you may need to check your namespace ProfileController. It should be:

namespace YourProjectName.Areas.Member
+1
source

Source: https://habr.com/ru/post/1775772/


All Articles