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 client's IP address and computer name.
I tried methods from internet searches but I get "SERVER IP" an "SERVER NAME". I think it's logical because all methods I tried is C# code that proceed server side.
So, I think I must use client side code like JavaScript.
Does anyone have the right method to do this?
You could use the UserHostAddress
and UserHostName
properties on the Request
object:
string ip = Request.UserHostAddress;
string hostname = Request.UserHostName;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With