I am using asp.net MVC. My code is:
var url = Url.Action(
"ConfirmEmail", "Account",
new { userId = id, code = code },
protocol: Request.Url.Scheme);
On localhost it is returning right url i.e,
https://localhost:44300/Account/ConfirmEmail?userId=bed34d05-2b7b-49b8-940e-0d89d4870d17&code=AQAA
But on live website its not working as expected. The url it returns is:
http://newtemp.apphb.com:16169/Account/ConfirmEmail?userId=7ba65316-0901-4c27-9371-588a5e945baa&code=AQAA
the portion :16169
is addational. Where it came from and how to remove this?
My detailed code is:
public async Task<bool> SendMailtoConfirmEmailAddress(string id,string name,string email)
{
var user = await db.AspNetUsers.FindAsync(id);
if (user.EmailConfirmed)
{
return false;
}
try
{
var provider = new DpapiDataProtectionProvider("http://newtemp.apphb.com/");
UserManager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser, string>(provider.Create("UserToken"))
as IUserTokenProvider<ApplicationUser, string>;
var code = await UserManager.GenerateEmailConfirmationTokenAsync(id);
var callbackUrl = Url.Action(
"ConfirmEmail", "Account",
new { userId = id, code = code },
protocol: Request.Url.Scheme);
ElectronicsController.sendEmail(email, "Welcome to dealkar.pk - Confirm Email address", "Hello " + name + "!<br/>Confirm your email address by clicking <a href=\"" + callbackUrl + "\">here</a> OR " + callbackUrl);
}
catch (Exception e)
{
string s = e.ToString();
}
return true;
}