Как Вы получаете IP-адрес от запроса в ASP.NET?

25
задан 15 May 2009 в 04:31
поделиться

4 ответа

 IpAddress=HttpContext.Current.Request.UserHostAddress;
7
ответ дан Taran 15 October 2019 в 16:16
поделиться

Используйте этот код:

public static string GetIpAddress()
    {
        return HttpContext.Current != null ? HttpContext.Current.Request.UserHostAddress : "";
    }
0
ответ дан Ankur vijay 15 October 2019 в 16:16
поделиться
Request.ServerVariables["REMOTE_ADDR"]

To access an index or property on C#, you should use [ ] instead of ( )

5
ответ дан 28 November 2019 в 21:01
поделиться

One method is to use Request object:

protected void Page_Load(object sender, EventArgs e)
{
    lbl1.Text = Request.UserHostAddress;
}
33
ответ дан 28 November 2019 в 21:01
поделиться
Другие вопросы по тегам:

Похожие вопросы: