简体   繁体   中英

Renaming Razor pages in asp.net Core 2 Identity

I'm starting a new project using asp.net Core 2 with Identity, and would like to change the Razor pages Register.cshtml and Register.cshtml.cs pages to Signup.cshtml and Signup.cshtml.cs . However, after doing so, the page will show validation errors but will not submit and I cannot hit a breakpoint in the OnPostAsync . Is there something going on "under the hood" that prevents this from working?

After scaffolding Identity to your project , rename the Register.cshtml to Signup.cshtml won't work since the Register button will still redirect to /Identity/Account/Register , which is controlled by Identity RCL after renaming .

You can modify the _LoginPartial.cshtml , and change the link to :

<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Signup">Register</a>

So that it will use the Signup page .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM