I am using .NET authentication, the application (Razor Pages) not confirmed the account because the code is null but it's exists in the link, why is that?
code exists in the link i received
I deployed the database and the application for free hosting because I thought that's the reason but it's not.
& is not exist in 'callbackUrl'
i think the problem is here: var confirmCode = HtmlEncoder.Default.Encode(callbackUrl);
i think the problem is here:
var confirmCode = HtmlEncoder.Default.Encode(callbackUrl);
Yes, it is. HTML encoding is used for encoding HTML for display in a web page. It converts HTML characters to their entities (e.g. <
becomes <
and &
becomes &
) so that you don't embed actual HTML into your page.
When encoding a URL, you should use the WebUtility.UrlEncode
method instead: https://learn.microsoft.com/en-us/dotnet/api/system.net.webutility.urlencode?view=net-7.0, then URL-safe characters like &
are not altered, and your query string is understood correctly by the model binder.