The application splits into two streams; The main web application and the secondary thread used to handle asynchronous events. The secondary stream receives an event in which it needs to send an email with the full URL of the main application (plus additional route arguments) inside it.
Eg. http://Server.com/App/RouteData?AdditionalArguments
Of course, in the background thread there is no way to use HttpContext.Current to resolve Url, because there is no request. No HttpRequest, No HttpContext ...
I found that most ASP.NET methods (even with MVC) used to create URLs are based on HttpContext. Is there a way to create a fully qualified application URL in ASP.NET without using HttpContext or any of its derivatives?
I am looking for a safe thread, for example:
UrlHelper.GetApplicationtUrl()
Any ideas? Your suggestions are greatly appreciated.
source share