c# - Url.Route in ApiController doesn't include hostname -


from apicontroller, generating password reset link emailed user. works except url.route function doesn't generate link hostname. i'm not sure if it's because i'm using localhost that's causing problem.

this code generate link

string callbackurl  = url.route("defaultapi", new { controller = "account", action= "resetpassword", userid = user.id, code = code }); 

this link generated

https:///api/account/resetpassword?userid=aaaaaaaaaa&code=aaaaaaaaa 

notice https:///api, should include hostname , port https://localhost:4040/api. why isn't hostname being included?

url.route generates relative urls only. absolute url, use url.link:

string callbackurl  = url.link("defaultapi", new { controller = "account", action= "resetpassword", userid = user.id, code = code }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -