title: ASP.NET Core 6 razor page routing default page route within different Areas
body: <p>In .NET 6 Razor pages, when I use the following code to map page routes while the pages are in the default pages folder or sub-folder of it, it works perfectly like that:</p>
  <pre><code>builder.Services.AddRazorPages()
      .AddRazorPagesOptions(options =&gt;
      {       
          options.Conventions.AddPageRoute(&quot;/Account/login&quot;, &quot;login&quot;);
      }
      ).AddRazorRuntimeCompilation(); 
  </code></pre>
  <p>where the page structure is <code>Pages/Account/*.*</code></p>
  <p>However, when I try to map page routes of a page under an area that is not under the default pages folder it does not work as follows:</p>
  <pre><code>builder.Services.AddRazorPages()
      .AddRazorPagesOptions(options =&gt;
      {       
          options.Conventions.AddPageRoute(&quot;/identity/Account/login&quot;, &quot;login&quot;);
      }
      ).AddRazorRuntimeCompilation(); 
  </code></pre>
  <p>given that, <code>/identity/Account/login</code> is under the directory <code>/Areas/identity/pages/Account/login</code> and the default <code>Pages</code> folder is pages in the same level as areas folder. i.e. both the areas and main pages folder (pages) are direct children of the main folder.</p>
  <p>Notes:</p>
  <ol>
  <li>When I access <code>http://localhost/identity/Account/login</code> - it works well</li>
  <li>When I add attribute routing in the display template login in the to add - page <code>/</code> it works fine.</li>
  </ol>