Is it possible to retrieve the date/time of a request in ASP.NET (preferably VB.NET)?
I have tried HttpContext.Current.Request.Headers.Get("date")
, but it returns nothing (null).
Is it possible to retrieve the date/time of a request in ASP.NET (preferably VB.NET)?
I have tried HttpContext.Current.Request.Headers.Get("date")
, but it returns nothing (null).
Well, DateTime.Now
will do the job in most circumstances. If you want to know date and time on client machine, you can approximate that by adding/subtracting clients' timezone offset.
According to w3c there is no "Date" header in HTTP request (but there is one in HTTP response), so you can only determine when ASP.NET've recived paticular request, but not when it was send. If you need time of receiving of a HTTP request you can use DateTime.Now, but how to do this in the best way I can answer only if you will describe you task with more details.