This is practically my first day in this after an intensive course last week, so I’m a little ropey when it comes to terms, but have spotted an issue as i practice and wondered if there was a way out of it.
I have some controllers, and they are calling the correct .cshtml file depending on what button is clicked, I have a this bit of code below that displays a page at the moment called ‘FunnyBones’
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Funny Bones", "FunnyBones", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
When the button is clicked at the moment the url is - http://localhost:55666/FunnyBones, but what I need really is http://localhost:55666/Funny-Bones
So below I tried to set it like this
public ActionResult Funny-Bones()
{
ViewBag.Message = "This is funny bones.";
return View();
}
But the dash between Funny and Bones causes an error, and that is calling at the moment a .cshtml file called FunnyBones.cshtml, when ideally I need it to have the dash.
As you will probably know, changing FuunyBones() to Funny-Bones() crashes it in HomeController.cs
I hope that makes sense