How to use route parameters in a razor page?

I am trying to use route parameters.

I started off with,
@page “/Index/{var1:int}”

then,

But this does not work on VS. The home page loads with 404 error. Why is this?
It does not work even when I do this,
@page “/Index” on the Index.cshtml

Is there anything extra that needs to be done fro localhost?

can you please share your source code? maybe I can get some idea how to answer your question.