【发布时间】:2016-02-05 00:30:00
【问题描述】:
NET MVC 5** 我想要这样的网址 http://borntoprogram.com/.Net/.Net-Core/
我知道我可以使用如下所示的属性路由来实现它
[RoutePrefix(".Net")]
[Route("{action=Index}")]
public class NetController : Controller
{
[Route(".Net-Core")]
public ActionResult NetCore()
{
return View();
}
}
但我想动态生成控制器和操作方法。并使用属性路由。
我想在 URL 中使用 Dots (.) ,
第二件事我希望 url 非常简单,只有 3 个部分
域名/CategoryOfArticle/ArticleName
如 URL DomainName -BornToProgram.com , CategoryofArticle -.Net , ArticleName -.Net-Core
在所有我想允许管理员决定部分 URL 用于他可以每月或每天提交的新文章。 喜欢文章的类别(例如.Net) 然后是文章名称(.Net-Core,.Net-Framework) 管理员希望完全控制 URL
【问题讨论】:
-
什么意思动态生成控制器和动作方法?
标签: c# asp.net-mvc asp.net-mvc-5 asp.net-mvc-routing