how to get the user's ip address on web server?

前端 未结 4 845
攒了一身酷
攒了一身酷 2021-01-15 19:18

I have a problem to get the user\'s ip address into web server. I am using this code..

//To get the local IP address 
            string sHostName = Dns.Get         


        
4条回答
  •  逝去的感伤
    2021-01-15 19:40

    The code you have used only work in case of windows application (Client server architecture) But to get the users ip address in web application you need to use

    Request.UserHostAddress
    

提交回复
热议问题