I have a cutoff time for user in my application so for this I dont want to take the current system time and instead开发者_运维问答 I want to take the remote server machine's time in to consideration so How can i get the remote servers date and time in c#
Write a request handler on your server that sends the date time. Without more details, its difficult to know how to implement that.
Write a simple web service that when invoked returns the timestamp (possibly using UTC or something).
[WebMethod]
public string ServerDateTime()
{
serverDate = DateTime.UtcNow;
return serverDate.ToString();
}
You could be even lazier and have a standard asp.net page that has the same web method as well. Example: http://softwaredevscott.spaces.live.com/blog/cns!1A9E939F7373F3B7!484.entry
精彩评论