Getting Ip Address In MVC
Hi,How can i get the IP address in mvc.
i have one menu when i clcik it, it will show the IP address. please it is urgent any one explain me with controller and view
using System.Net;
var ipAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.GetValue(0).ToString();
using System;
using System.Web.Mvc;
namespace Mvc.Controllers
{
public class HomeController : ClientController
{
public ActionResult Index()
{
string ip = Request.UserHostAddress;
}
}
}