Here I have a razor cs page:
public IActionResult OnPost(){
if (!ModelState.IsValid) {
return Page();
}
return RedirectToPage('Pages/index.cshtml');
}
And a cshtml page:
@page
@using RazorPages
@model IndexModel
<form method="POST">
<input type="submit" id="Submit">
</form>
I want to redirect to the same page on form submit but I keep getting 400 error. Is it possible to do the redirect without using routes and just go to cshtml file in the url?