I know this question has been asked many times here, but no answer has provided me with a solution yet. Please help, I'm beating my head against the wall.Problem:I have a simple ASP.NET web forms app with one page - Default.aspx. This page has jQuery, JSON2, Rick Strahl's ServiceProxy.js, and my javascript file referenced (timezone.js). In the same project I have a WCF service that I call from timezone.js using ServiceProxy (which is a convenient wrapper around jQuery's .ajax POST). The call should return an object that has a DateTime property. I am testing on two client machines in different time zones and getting different results. Here are the screenshots of the app hosted is IIS:EDIT: Looks like StackOverflow isn't letting me post images. Here is the rendered text...On the GMT machine I get
ate rendered by js from WCF call: Fri Sep 28 13:30:00 UTC+0100 2012On the Eastern Standard Time machine I get: Date rendered by js from WCF call: Fri Sep 28 08:30:00 EDT 2012As you can see on the right side of both screenshots, the WCF call results in different times.I want complete control over what dates are sent back and I'm this close to converting it to a string on the server and parsing the string in javascript. I also must use POST to a WCF Enabled Ajax Service.Here is the code behind for Default.aspx\[code\]public class DateContainerObject{ public DateTime theDate { get; set; }}public static class DateMaker{ public static DateContainerObject MakeDateObj() { DateContainerObject obj = new DateContainerObject(); DateTime origUTCDate = new DateTime(2012, 9, 28, 13, 30, 0); DateTime newKindDate = DateTime.SpecifyKind(origUTCDate, DateTimeKind.Unspecified); obj.theDate = newKindDate; return obj; }}public partial class Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { Literal1.Text = DateMaker.MakeDateObj().theDate.ToString(); }}\[/code\]Here is the WCF Service code:\[code\][ServiceContract(Namespace = "")][AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]public class TimeZoneService{ [OperationContract] public DateContainerObject GetDateObject() { return DateMaker.MakeDateObj(); }}\[/code\]This is the timezone.js code:$(function () {\[code\]var dObj = {};var proxy = new ServiceProxy("/TimeZoneService.svc/", { isWcf: true });proxy.invoke("GetDateObject", dObj, function (result) { $('#spanDateJSRender').text(result.theDate); }, function (e) { alert(e); }, function () { }, false );\[/code\]});I've tried specifying the DateTimeKind to all different values, but it doesn't give me accurate date and time. I've also tried using DateTimeOffset and I get the same results.What can I do with this example to get the exact DateTimes that are created on the server to render in the browser?Thanks for your help.
