At the end, I ended up modifying the original ashx handler in the "fullcalendar-asp-net" project. Instead of adding events to a string in a foreach loop, I created an event list and converted it to Json string with this code.
System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(tasksList);
context.Response.Write(sJSON);
The full ashx code is like this.
/// <summary>
/// Summary description for JsonResponse
/// </summary>
public class JsonResponse : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//CONVERT FROM UTC TIMESTAMP TO LOCAL DATETIME
DateTime start = ConvertFromTimeStamp(long.Parse(context.Request.QueryString["start"]));
DateTime end = ConvertFromTimeStamp(long.Parse(context.Request.QueryString["end"]));
List<int> idList = new List<int>();
List<ImproperCalendarEvent> tasksList = new List<ImproperCalendarEvent>();
//GENERATE JSON SERIALIZABLE EVENTS
foreach (CalendarEvent cevent in EventDAO.getEvents(start, end))
{
tasksList.Add(new ImproperCalendarEvent
{
id = cevent.id,
title = cevent.title,
start = ConvertToTimestamp(Convert.ToDateTime(cevent.start).ToUniversalTime()).ToString(),
end = ConvertToTimestamp(Convert.ToDateTime(cevent.end).ToUniversalTime()).ToString(),
description = cevent.description,
allDay = cevent.allDay,
}
);
idList.Add(cevent.id);
}
context.Session["idList"] = idList;
//SERIALIZE EVENTS TO STRING
System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(tasksList);
//WRITE JSON TO RESPONSE OBJECT
context.Response.Write(sJSON);
}
/// <summary>
/// Converts a UTC transformed timestamp into a local datetime
/// </summary>
/// <param name="timestamp"></param>
/// <returns></returns>
private DateTime ConvertFromTimeStamp(long timestamp)
{
long ticks = (timestamp * 10000000) + 621355968000000000;
return new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
}
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static long ConvertToTimestamp(DateTime value)
{
TimeSpan elapsedTime = value - Epoch;
return (long)elapsedTime.TotalSeconds;
}
public bool IsReusable
{
get
{
return false;
}
}
}
When I asked this question, I was using a web method instead of that handler, so my js code to call the calendar was different than it should be. Now, I am using exactly the same method which was explained in the fullcalendar offical documentation. Like;
$('#calendar').fullCalendar({
events: '/myfeed.php', }); // for me, that is "JsonResponse.ashx"
Now it works with the latest version of all scripts which I mentioned at the question. Jquery 1.10.2, Jquery-UI 1.10.3 and fullcalendar 1.6.4. And it works perfectly!
I hope that others who had trouble figuring out that issue won't suffer as I did :)
Thanks!