Base solution for your next web application
Open Closed

Get absolute url from inside an ApplicationService ? #114


User avatar
0
guillaumemorin created

Is there a built-in ABP class that I can inject into my ApplicationService, to retrieve an absolute url of a page in my app ? I need to send an email containing an url to my app.

Thanks!


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    No, there is not. You can create an interface (like IWebUrlService) in Core project and implement it in .Web project (with WebUrlServiceName) and register it to DI (you can simply implement ITransientDependency). Then inject IWebUrlService and use anywhere.

    Notice that: Absolute URL of a web site may not be known if you can not reach to HttpContext.Current.Request or maybe your code is running in a Windows Service etc. In that case, you can define a setting for that.