Get client's IP address and computer name?

asp.net, c#, javascript

Solution

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

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

Problem

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?

Original source