Post your source code in GitHub if you want/need a community code review.
I created a test based on your source and passing parameter in the URL works as expected.
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=ParamIndex}/{id?}");
app.MapRazorPages();
app.Run();
carindex.cshtml
@page "/carindex"
@model RazorPagesWithMvc.Pages.carindexModel
<h1>Car Index</h1>
<div>Path = @Model.Path)</div>
<div>ApiKey = @Model.ApiKey)</div>
@{
}
carindex.cshtml.cs
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace RazorPagesWithMvc.Pages
{
public class carindexModel : PageModel
{
[BindProperty(SupportsGet = true)]
public string Path { get; set; } = "";
[BindProperty(SupportsGet = true)]
public string ApiKey { get; set; } = "";
public void OnGet()
{
}
}
}
URL
https://localhost:7027/carindex/?path=some/path&apikey=123