public partial class chat : System.Web.UI.Page
{
protected void getIP()
{
string IPadresi = string.Empty;
if(HttpContext.Current.Request.ServerVariables["HTTP_X__FORWARDER_FOR"]!= null)
{
IPadresi = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDER_FOR"].ToString();
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
IPadresi = HttpContext.Current.Request.UserHostAddress;
}
Label1.Text = "IP niz:" + IPadresi;
}
protected void Page_Load(object sender, EventArgs e)
{
getIP();
}
}
ASP.NET IP Adresi Kontrolu
Kaydol:
Yorumlar (Atom)
Siz bunu ASP.NET kaç versionunda yaptınız...
YanıtlaSil