How do I get an IP address in ASP.NET Core View

How do I get an IP address in ASP.NET Core View, Read More !!!

If you want to access the current IP Address using Javascript in ASP.NET Core View then you need to write the code.

<script type="application/javascript">
  function getIP(json) {
    document.write("My public IP address is: ", json.ip);
  }
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>

Leave a Comment