views:

19

answers:

1

I need to get the browser user local date and Time on my server side asp vbscript page.

The goal is to show a specific message to all connected users that are in conversation at a specific local time in my web chat application.

Is that possible?

One way is to include the local time on an hidden text field and then pass it through using ajax/javascript but it's not secure because user could change it and find the secret time on server side.

+1  A: 

The best I can think of would be to cross-reference Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"] to a time zone offset and then calculate their local time using UTC. The liabilities here are trusting that their local language setting corresponds to their time zone appropriately and that your accuracy doesn't need to be perfect all of the time (multiple time zones per language code).

Alternatively, if you can afford to be lazy in this case (how important is this local time to your app?), you could just write some purposely obscure js code to smuggle the local system's current time as a long int and named something misleading for those hackers interested in spoofing your js.

Tahbaza