using Microsoft.AspNetCore.Mvc; namespace GPW.CORE6.Smart.Controllers { [Route("api/[controller]")] [ApiController] public class InfoController : ControllerBase { /// /// Controller epr recuperare l'IP del chiamante /// /// rif: https://bartecki.me/blog/Blazor-serverside-get-remote-ip /// https://stackoverflow.com/questions/57982444/how-do-i-get-client-ip-and-browser-info-in-blazor /// /// [HttpGet] [Route("ipaddress")] public async Task GetIpAddress() { var remoteIpAddress = this.HttpContext.Request.HttpContext.Connection.RemoteIpAddress; await Task.Delay(1); if (remoteIpAddress != null) return remoteIpAddress.ToString(); return string.Empty; /* Per impiegarlo aggiungere in Host.cshtml */ } } }