So I'm trying to write a bit of code that takes in a video from YouTube and adds it to a list. I'm doing this by passing in a url to a form and passing it to the controller. However, nothing happens.
View:
<form asp-action="addVideo" asp-controller="Video" validate="validate">
<input name="vidUrl" type="url" placeholder="Search for a video" required="required"/>
<input type="submit" value="Search"/>
</form>
Controller:
public ActionResult addVideo(string vidUrl)
{
//Do stuff...
return RedirectToAction("Index");
}
I have tried debugging addVideo, but submitting the form never triggered the breakpoint. The resulting url looks like http://(domain)/Video?vidUrl=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdTDy8XVdRSk
Is there a reason that the view isn't calling the controller?
Update:
I know what's causing the issue. It's definitely the asp-action and asp-controller tags. I have a navbar up on top of my web page that previously was controlled by razor statements like @Html.ActionLink("Home","Index","Home"). I tried switching this link to a set of anchor tags with the same controller and action values, but it has no effect on the website. Is this an issue with packages?