Get client's IP address and computer name?

后端 未结 1 458
既然无缘
既然无缘 2021-01-06 05:15

I have an ASP.Net 4.0 application, published on a company intranet network on an IIS 7.0 server, and I want to save the client\'s IP address in my database. So I want to get

1条回答
  •  盖世英雄少女心
    2021-01-06 06:03

    You could use the UserHostAddress and UserHostName properties on the Request object:

    string ip = Request.UserHostAddress;
    string hostname = Request.UserHostName;
    

    0 讨论(0)
提交回复
热议问题