MVC 域(area)
using System.Web.Mvc;
namespace PDS.Web.Areas.Manager
{
public class ManagerAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Manager";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Manager_default",
"Manager/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
//"Manager/{action}/{id}",
//new { controller = "Manager", action = "Index", id = UrlParameter.Optional }
);
}
}
}
获取域名:
<%= Html.ActionLink("修改密码", "EditPassword", "Admin", new { area = "Manager" }, null)%>
Controller:Admin (this.ViewContext.RouteData.Values["controller"])
action:LogOn (this.ViewContext.RouteData.Values["action"])
area:Admin(this.ViewContent.RouteData..DataTokens["area"]
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。