我有一个新的MVC-2项目,我在其中添加了“成员”区域。我创建了一个名为'profile‘的控制器。
这是可行的:http://localhost:1234/Profile (加载index()函数)
但是这不是:http://localhost:1234/Member/Profile (我得到了一个404错误)
我是不是漏掉了什么?
发布于 2010-11-19 15:50:49
这没有理由不起作用。从默认项目模板:
右键单击项目add -> Area:Member
~/Areas/Member/Controllers add ProfileController containing a default Index ->
~/Areas/Member/Views/Profile Add Index.aspx
~/Areas/Member/Views/Profile->并导航到/member/profile =>它显示了新添加的页面<代码>H215<代码>G216发布于 2010-11-19 10:13:07
你能检查一下你的Global.asax.cs文件吗,看看它在Application_Start中是否有下面的代码
AreaRegistration.RegisterAllAreas();发布于 2011-01-20 04:08:09
如果http://localhost:1234/Profile正常工作,您可能需要检查ProfileController的名称空间。它应该是:
namespace YourProjectName.Areas.Memberhttps://stackoverflow.com/questions/4221451
复制相似问题