title: Can't get razor page route to work using anchor tag helper
body: <p><strong>Background</strong></p>
  
  <p>This is a follow on issue to an <a href="https://stackoverflow.com/questions/60223804/multiple-routes-to-the-same-razor-page/60257348">initial question</a> I asked around asp.net core v3.1 razor page routes.</p>
  
  <p>I added the following to the startup as suggested in the solution <a href="https://stackoverflow.com/a/60257348/6479619">here</a> which allowed me to route to the razor page in both ways I wanted:</p>
  
  <pre class="lang-cs prettyprint-override"><code>services.AddMvc()
          .AddRazorPagesOptions(options =&gt; 
                   options.Conventions.AddAreaPageRoute("Identity", "/account/signupandapply", "/identity/account/signup")
          );
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>/identity/account/signup
  /identity/account/signupandapply/&lt;fooapplyid&gt;
  </code></pre>
  
  <p><strong>Issue</strong></p>
  
  <p>I'm struggling to use the anchor tag helper to respect the path route <code>/identity/account/signupandapply/&lt;fooapplyid&gt;</code>. The href shows using the parameter instead <code>/identity/account/signupandapply?fooapplyid=&lt;fooapplyid&gt;</code>. This is my anchor tag helper markup:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a asp-area="identity" asp-page="/account/signupandapply" asp-route-fooapplyid="@Model.FooApplyId"&gt;Apply here&lt;/a&gt;
  </code></pre>
  
  <p>Currently, I'm manually setting the href but would like to know how to get this working using the tag helper.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a href="/identity/account/signupandapply/@Model.FooApplyId"&gt;Apply here&lt;/a&gt;
  </code></pre>
  
  <p><strong>Note:</strong> The anchor markup is being added to a view outside of the identity area.</p>
  
  <p><strong>Attempted</strong></p>
  
  <p>I've tried adding the below which shows the href as I want. I.e <code>/identity/account/signupandapply/&lt;fooapplyid&gt;</code></p>
  
  <pre class="lang-cs prettyprint-override"><code>.AddAreaPageRoute("Identity", "/account/signupandapply", "/identity/account/signupandapply/{applyid}")
  </code></pre>
  
  <p>But I then get an error when I go to the page, which makes sense</p>
  
  <pre class="lang-cs prettyprint-override"><code>AmbiguousMatchException: The request matched multiple endpoints. Matches: /Account/SignUpAndApply /Account/SignUpAndApply
  </code></pre>
  
  <p>Neither of these work, the href still shows as ?applyid=:</p>
  
  <pre class="lang-cs prettyprint-override"><code>.AddAreaPageRoute("Identity", "/account/signupandapply?applyid=", "/identity/account/signupandapply/{applyid}")
  
  .AddAreaPageRoute("Identity", "/account/signupandapply/{applyid?}", "/identity/account/signupandapply/{applyid}")
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>Is there a further startup route that needs defining or how do I get the anchor tag helper to respect the path route?</p>