Im currently doing a console app that has to send scheduled emails. In one of the emails I have to put the url of the page, something like this:
var message = string.Format("Go to our web site
<a href=\"" + "http://" + Request.Url.Authority + Url.Action("action", "Controller", new { requestID = request.ID }) + "\">Click Here</a>");
Obviously the Request.Url.Authority will only work in the ASP.Net MVC3 app that I have. But I’m not sure if there is a way to get to the full route name in the console app. Maybe if I reference the web app in the console app… but then I dont know what else to do.
A console app doesn’t run in the context of the website, so you won’t have access to anything related to the website.
You can configure this ahead of time though in the app.config file.
and in code you can do this to get this value: