I have a .NET web service.
It serves AJAX requests from web users.
I would simply like to know how to automatically get the user's timezone… Not current time offset, but the actual timezone – like, Central Standard Time is -5:00 right now, but Eastern Standard Time will be -5:00 once daylight savings is over. I want to differentiate these users.
I would also like to know how to get their culture settings ("en-US", etc.) so I can render DateTimes and numbers from my web service to their specific preferences.
Any Javascript or .NET solution will work.
Thanks.
Note: Asking the user would be a complete last resort, since it's a web service.
Best Answer
Assuming your clients connect to the webservice from a browser, you can use Request.Headers["Accept-Language"] to detect the browser's culture settings.It is not possible to get the timezone directly from the server, you need some javascript on the client to compute a time difference between their local clock and GMT.
If your webservice is consumed diferently (ie. not from a browser), you will need to add these two pieces of information as parameters to your webservice methods.