1、删除 xxxAreaRegistration.cs文件
2、HomeController
1 [RouteArea("Mobile")] 2 [RoutePrefix("Home")] 3 [Route("{action = Index}")] 4 public class HomeController : Controller 5 { 6 // GET: Mobile/Home 7 [Route] 8 [Route("Index")] 9 public ActionResult Index() 10 { 11 var dtIndexBN = CSA_BLL.Ad.Ad.GetAdByAdKindCode("01"); 12 ViewBag.BNList = dtIndexBN; 13 14 return View(); 15 } 16 }
2、JoinController
1 [RouteArea("Mobile")] 2 [RoutePrefix("Join")] 3 [Route("{action = Index}")] 4 [Route("{controller=Join}/{action= Index}/{code}")] 5 public class JoinController : Controller 6 { 7 private CSA_BLL.Entity.JsonMessage jm = new CSA_BLL.Entity.JsonMessage(); 8 // GET: Mobile/Join 9 [Route] 10 [Route("Index")] 11 [Route("Index/{code}",Name = "JoinCode")] 12 public ActionResult Index() 13 { 14 ViewBag.CurKindName = CSA_BLL.Article.Kind.getKindName("07"); 15 ViewBag.CurKindList = CSA_BLL.Article.Kind.getKind("07", 2); 16 ViewBag.NewList = CSA_BLL.Article.Article.getArticle("07", 0, "Bs_NewsKindCode asc"); 17 return View(); 18 } 19 }
3、生成链接
@Url.RouteUrl("JoinCode", new {action="Index",controller="Join",code=item["code"]})