I am using RazorPages in ASP.NET Core v2.0, and I was wondering if anyone knows how to force the AnchorTagHelper
to use lowercase?
For example, in my .cshtml
mark-up, I would have the following anchor tag using the asp-page
tag helper:
<a asp-page="/contact-us">Contact Us</a>
The output that I am looking for
// i want this
<a href="/contact-us">Contact Us</a>
// i get this
<a href="/Contact-us">Contact Us</a>
To give it more context to why this is important to my web app, please imagine a long url like what you would see at stackoverflow.com
https://stackoverflow.com/questions/anchortaghelper-asp-page-to-use-lowercase
-- VS --
https://stackoverflow.com/Questions/Anchortaghelper-asp-page-to-use-lowercase
Any help would be appreciated!
I have looked at these other references but no luck:
Add the following to your ConfigureServices
method in Startup.cs
. It can be added before or after services.AddMvc();
services.AddRouting(options =>
{
options.LowercaseUrls = true;
});
Now for the anchor tag
<a asp-page="/Contact-Us">Contact Page</a>
And the output
<a href="/contact-us">Contact Page</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With