У меня есть адрес, подобный следующему:
www.stack.com/content-00000/solutions-about
Моя регистрация маршрута (непроверенная, но, возможно, на 90% в порядке) выглядит следующим образом:
public class ContentAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Content";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Content_default",
"content-{id}/{title}",
new { controller = "Server", action = "Get" },
new { id = @"^\d{5}$" }
new { title = UrlParameter.Optional }
);
}
}
Может кто-нибудь подтвердить, если этоправильный путь для меня, чтобы сделать маршрут
a) Go to the "Content" Area
b) Go to the "Server" Controller
b) Go to the "Get " action
c) Five digits that follow will be put into a parameter called id?
Также, как я могу сделать это перейти к другому действию, такому как «ошибка», если «Content-» не сопровождается пятью числами?