I'm calling Url.Action from a .net core api so there is no page url root to call upon.
How can I pass one in?
What I have tried:
This is the original code (not doing the job):
string confirmationLink = Url.Action("SetPassword",
"Account", new
{
userid = userMaster.Id,
token = confirmationToken
},
protocol: HttpContext.Request.Scheme);
Here are some of my efforts - two return null, the middle one does not build:
var aUrl = Url.RouteUrl("https://localhost:5101/", new { id = "MailRoot", category = "confirmationURLs" });
Url.RouteUrl uri1 = new Url("http://mypage.com/");
var url2 = Url.RouteUrl("MailRoot", "https://localhost:5101/");
The final outcome needs to be something like this:
Please confirm your account by clicking this <a href='https://localhost:5101/Account/SetPassword?userId=6fb79cd9-2030-494a-aade-47c770a9f0da&token=ALongToken'>link</a>.
Workaround: building the link as a plain string - carefully!
This does not answer the question asked, but it provides me with a functional solution that I can proceed with:
string confirmationLink = ${this.config.p_ConfirmationURLRoot}/{this.config.p_ConfirmatonURLController}/{this.config.p_ConfirmationURLAction}?userId={ userMaster.Id}&token={ confirmationToken}";