I need some help right there.
I'm using ASP.NET Core 3.1 MVC, all is going well, but not for a specific action.
I have several pages : Start -> Index -> AddUser.
I navigate between my pages thanks to <button>
s.
Index.cshtml :
<form asp-controller="Home" asp-action="AddUser" asp-route-GB="@ViewBag.GB">
<button type="submit" class="btn btn-success">Add</button>
</form>
HomeController.cs :
[HttpGet]
public ActionResult Start(string GB) {
if (string.IsNullOrEmpty(GB)) {
return RedirectPermanent("Error");
}
else {
return View();
}
}
[HttpGet]
public ActionResult Index(string GB) {
if (string.IsNullOrEmpty(GB)) {
return RedirectPermanent("Error");
}
else {
return View();
}
}
[HttpGet]
public ActionResult AddUser(string GB) {
if (string.IsNullOrEmpty(GB)) {
return RedirectPermanent("Error");
}
else {
return View();
}
}
public ActionResult Error() {
return View();
}
URL results :
https://localhost:XXXXX/Home/Start?GB=1
-> Is going well.
https://localhost:XXXXX/Home/Index?GB=1
-> Is going well.
https://localhost:XXXXX/Home/AddUser?GB=1
-> HTTP ERROR 405
BUT ! If I add a slash to this last one :
https://localhost:XXXXX/Home/AddUser/?GB=1
-> Is going well.
What is going on ? I don't want to add a slash on my browser to make it work...