Hallo allerseits Ich möchte URL wie {Controller}/{aktion}/{postid} - {Adresse} bekommen, aber routerUrl gibt null zurück, bitte hilf mir, es zu lösen. (ich bin Neuling in MVC)Url.routeUrl gibt null zurück (ich habe die gleichen Fragen ausprobiert)
meine Route Config
routes.MapRoute(
name: "Post",
url: "Posts/Show/{postid}-{address}",
defaults: new { controller = "Posts", action = "Index", postid = "", address = "" }
);
und index.cshtml
<a href="@Url.RouteUrl("Post",new {item.PostId,item.Address })">@item.PostTitle</a>
die uRL, die zu erzeugen ist http://localhost:59066/Posts/Show/1-Post-with-Featured-Image
aber in Posts
public ActionResult Show(string add)
{ return View();}
"string add" ist null!
Ihr Parameter 'add' passt nicht zu' {postid} 'oder' {address} '! –