'How to stop area from automatically being added to the URL when using Url.Action?

The controller that calls this method is in Areas/AdminPortal, but I am trying to call a controller action that is not in Admin Portal. I have this code but it automaticaly assigns /AdminPortal to the start of the url.

string tokenVerificationUrl = Url.Action(nameof(AccountController.VerifyEmail).AspName(), nameof(AccountController).AspName(),
            new {id = user.Id, token = emailConfirmationToken }, Request.Scheme);

Returns localhost:1234/AdminPortal/Account/VerifyEmail/tokenValue

I want it to return localhost:1234/Account/VerifyEmail/tokenValue



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source