How do you handle routing in razor pages with a search string like this: https://localhost:5000/link?searchParam1=daniel&searchParam2=olu&Keyword=keyword. In Razor pages, you can adding the routing you want in at the top of the razor.chshtml file like so:
@page "/preferedroute"
@model Index
@{
}
How do I do this with the search string above. It has multiple parameters. How do I translate that to the preferred route so that other pages can access it. I have a form that submits to the page.
<form class="form-inline" id="form" action="preferedroute">
<input id="searchParam1 value="dan">
<input id="searchParam2 value="olu">
<input id="keyword value="keyword">
</form>
When I submit this form to page, it submits like so:
https://localhost:5000/link?searchParam1=daniel&searchParam2=olu&Keyword=keyword
but I need it to submit like so: https://localhost:5000/link/searchParam1/daniel/searchParam2/olu/Keyword=keyword
Now the problem is that I have this form in the shared _layout.cshtml file. So I cannot use tag helpers(asp-for) in the form like so because it does not have a page model:
<form class="form-inline" id="form" action="preferedroute">
<input asp-for="searchParam1" value="dan" >
<input asp-for="searchParam2 value="olu">
<input asp-for="keyword value="keyword">
</form>
How do I accomplish the required result when the form cannot use tag helpers?