I am using the Google Calendar API with the .NET library. i am already able to create a channel between my project and the Google Calendar Push notification. i am setting up a working Webhook address. i am able too to read the header
[System.Web.Mvc.HttpPost]
public string CalendarWebhook()
{
HttpContext ctx = HttpContext.Current;
if (ctx == null || ctx.Request == null || ctx.Request.Headers == null)
{
return string.Empty;
}
string headers = string.Empty;
foreach (string header in ctx.Request.Headers.AllKeys)
{
string[] values = ctx.Request.Headers.GetValues(header);
headers += string.Format("{0}: {1}", header, string.Join(",", values));
}
return "";
}
now i try to read the body. but nothing works. i already tried
var test = HttpContext.Current.Request.InputStream;
var sr = new StreamReader(test);
string documentContents = sr.ReadToEnd();
or
using (Stream receiveStream = HttpContext.Current.Request.InputStream)
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
documentContents = readStream.ReadToEnd();
}
}
But it did not work. And i could not find any examples or documentation. Hope that any body can help me. thank you in advance guys