ralphtrent
Programmer
Hi All
After many hours of trying to figure this out, I think I may have done it. I needed a way to save my clients UTCOffset to a cookie so I can adjust GMT time to their Local Time. This is how I accomplish it.
I have an htm page, called SetDefaults.htm, that has the following code
This creates the cookie data i need to tell me how many hours off UTC the client is.
In my Global.asax page I have the following
Now I can read the cookie using
Thats it.
RalphTrent
After many hours of trying to figure this out, I think I may have done it. I needed a way to save my clients UTCOffset to a cookie so I can adjust GMT time to their Local Time. This is how I accomplish it.
I have an htm page, called SetDefaults.htm, that has the following code
Code:
<html><head>
<script language="javascript">
var rightNow = new Date();
document.cookie="clientTimeZoneOffset=" + rightNow.getTimezoneOffset()/60+"; path=/";
location.reload();
</script>
</head><body></body></html>
This creates the cookie data i need to tell me how many hours off UTC the client is.
In my Global.asax page I have the following
Code:
protected void Session_Start(Object sender, EventArgs e)
{
Server.Transfer("~/SetDefaults.htm");
}
Now I can read the cookie using
Code:
Request.Cookies[clientTimeZoneOffset].Value
Thats it.
RalphTrent