0

How to retrieve client machine's name, and current time and date to save a log... I need syntax in ASP.NET using c#

Karthik Malla
  • 5,570
  • 12
  • 46
  • 89

1 Answers1

3

You cannot retrieve the client machine name on the server as this information is never sent to the server. You could retrieve the client IP though using the Request.UserHostAddress property. The current time on the client could be retrieved using the javascript Date object. To retrieve the time on the server you could use DateTime.Now property.

And by the way, your web server is logging all this information already, so you are probably doing some redundant work.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928