TransWikia.com

ASP.Net URL Page Helper for ASP.Net Identity Account Confirmation does not create the correct URL

Stack Overflow Asked by Jonas Arcangel on January 8, 2021

The following code from https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-3.1&tabs=visual-studio

EmailConfirmationUrl = Url.Page(
"/Account/ConfirmEmail",
pageHandler: null,
values: new { area = "Identity", userId = userId, code = code, returnUrl = returnUrl },
protocol: Request.Scheme);

generates the wrong URL (below). It should have /Identity/Account/ConfirmEmail as path. How do I fix code above so that I get the right path?

https://localhost:5001/?area=Identity&userId=d83c48d3-2715-4dc1-84d7-6e1c1cb0ae4a&code=Q2ZESjhGeERhR0hlUThoTHNqRU9iU3hLTDRJcUtaTVI0S2UrSFFMbjQvL0lhUVVkZ1dqL2dPWkVNQ3lHdGkweU5CWmdSdXM4NVE3Z0hhMWp0TWJGU0h4bFh6ZmhGVWRkNm5MbTg2VXRhTjNpTWozSUVreVlmMEdyUUF0QUJ2MVdNV0Y5aWtTRW05bGdMcXhqTk93TkoxeXNaSW9qWFhkeHN1TkNRK0lISXJnVjVIRFJNTVNaTWRDR1FjaVhoRDFXNllqcnVpYXV2ajNONlp5L1BBUnVKdzkreEt2aFh5emMxa0lhWmNJWk0zcG9DSmN2bzRwODl5Uko2NmRleVNCVUtyQnl5dz09&page=%2FAccount%2Fhttps%3A%2FBlazorWorld.com%2FAccount%2FConfirmEmail

One Answer

Please see answer to a previously asked question. Essentially Url.Page is for Razor actions. Url.Action is for MVC. Which type of pages are you using in your application?

If this helps you out, be sure to go give Ryan an upvote on his answer.

Answered by dave k on January 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP