hyperlink - Get the full domain Url from a Asp.Net Web App in a Console App -
im doing console app has send scheduled emails. in 1 of emails have put url of page, this:
var message = string.format("go our web site <a href=\"" + "http://" + request.url.authority + url.action("action", "controller", new { requestid = request.id }) + "\">click here</a>");
obviously request.url.authority work in asp.net mvc3 app have. i'm not sure if there way full route name in console app. maybe if reference web app in console app... dont know else do.
a console app doesn't run in context of website, won't have access related website.
you can configure ahead of time though in app.config file.
<appsettings> <add key="url" value="http://www.yoursite.com/" /> </appsettings>
and in code can value:
configurationmanager.appsettings["url"]
Comments
Post a Comment