Default.aspx:
Insert One Label in Form.
Default.aspx.cs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication4
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string VistorIpAddress = Request.UserHostAddress.ToString();
// both line of code functionality are same.
string VisitorIpAddress = Request.ServerVariables["REMOTE_ADDR"];
Label1.Text = VistorIpAddress + " " + VisitorIpAddress;
}
}
}
No comments:
Post a Comment