Base solution for your next web application
Open Closed

How to get client ip address in AppService #2441


User avatar
0
bycem created

Hi , Selamlar

How to get client ip address in AppService ?

public class MailAppService : NotificationAppServiceBase, IMailAppService
    {


        public MailAppService(IRepository<EmailEntity> emailRepository, IBackgroundJobManager backgroundJobManager)
        {
            _backgroundJobManager = backgroundJobManager;
            _emailRepository = emailRepository;
        }
.
.
.

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

    Hi,

    You can inject IClientInfoProvider interface in your app service and use it's GetClientIpAddress method. Implementation is here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/a706b7e8f497a4afe2bb746892fd6c010b0875fc/src/Abp.AspNetCore/AspNetCore/Mvc/Auditing/HttpContextClientInfoProvider.cs#L39">https://github.com/aspnetboilerplate/as ... der.cs#L39</a>.