Hi @David Thielen,
In your scenario, the parameter following
is present in the GET request but is lost during the POST request. This typically happens because POST requests do not automatically include URL parameters unless explicitly handled.
One way is that pass the Following
property value to asp-route-following
:
<form id="registerForm" asp-route-returnUrl="@Model.ReturnUrl" method="post" asp-route-following="@Model.Following">
Another way is you can set a hidden input for Following
:
<form id="registerForm" asp-route-returnUrl="@Model.ReturnUrl" method="post" >
<h2>Create a new account.</h2>
<hr />
<input type="hidden" asp-for="Following" />
<div asp-validation-summary="ModelOnly" class="text-danger" role="alert"></div>
<div class="form-floating mb-3">
<input asp-for="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
<label asp-for="Input.Email">Email</label>
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<div class="form-floating mb-3">
<input asp-for="Input.Password" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" />
<label asp-for="Input.Password">Password</label>
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
<div class="form-floating mb-3">
<input asp-for="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" />
<label asp-for="Input.ConfirmPassword">Confirm Password</label>
<span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
</div>
<button id="registerSubmit" type="submit" class="w-100 btn btn-lg btn-primary">Register</button>
</form>
Register.cshtml.cs
[BindProperty]
public string Following { get; set; }
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena