c# - Use Url.Action to generate fully qualified anchor -


i'm using url.action generate link in e-mails (with postal mvc framework) sent application, however, links generates showing "localhost" name, , not domain name.

i'm using following code:

@url.action("alterarsenha", "account", null, this.request.url.scheme) 

the result following:

http://localhost/account/alterarsenha 

after that, tried following code:

@url.action("alterarsenha", "account", null, this.request.url.scheme, request.servervariables["http_host"]) 

and got same result.

how can link domain like:

http://www.servicili.com/account/alterarsenha 

assuming want use domain name in url when application runs on localhost, use overload of url.action:

public virtual string action(     string actionname,     string controllername,     routevaluedictionary routevalues,     string protocol,     string hostname ) 

and pass domain name hostname.

https://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.action(v=vs.118).aspx


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -