I'm having an issue where my form submission url does not have a query string which points to the handler in the Code Behind. As a result I'm getting a 400 (bad request) error.
The request URL looks like this:
http://localhost:60900/EventRename
When it should look like this:
http://localhost:60900/EventRename?handler=RenameEvent
Here's the .cshtml
<form asp-page-handler="RenameEvent" method="post">
<div class="form-group">
<label asp-for="RenameDataSource"></label>
@Html.DropDownListFor(x => x.RenameDataSource, Model.DataSources, "-- select data source --")
</div>
<div class="form-group">
<label asp-for="RenameTempEvent"></label>
@Html.DropDownListFor(x => x.RenameTempEvent, Model.RenameTempEvents, "-- select event type --")
</div>
<div class="form-group">
<label asp-for="NewName"></label>
@Html.DropDownListFor(x => x.NewName, Model.EventTypes, "-- select event type --")
</div>
<div class="form-group">
<button type="submit">Start Renaming</button>
</div>
</form>
It might be related, but I've also noticed that the form data is missing the '__RequestVerificationToken', which should be included by default in Razor pages?
To clarify, I'm not expecting to see the data from the form in the URL. I'm expecting to see a handler reference so the Razor Code Behind knows which method to run when the form is submitted. See this section: https://docs.microsoft.com/en-us/aspnet/core/razor-pages/#multiple-handlers-per-page
the URL path that submits to OnPostJoinListAsync is http://localhost:5000/Customers/CreateFATH?handler=JoinList