我正在尝试为Google日历提供由IIS提供的日历网址(ASP.NET)

时间:2018-02-28 14:53:47

标签: c# asp.net icalendar

当我将.ics文件放在网站的一个文件夹中并使用它的URL时,谷歌会识别它并将其可视化,但当我尝试提供文件时,谷歌不会做任何事情。< / p>

这就是我到目前为止所拥有的:

        [AllowAnonymous]
    public FileResult Test()
    {
        byte[] calendarBytes = Encoding.UTF8.GetBytes(System.IO.File.ReadAllText(@"<filename>", Encoding.UTF8));

        var cd = new System.Net.Mime.ContentDisposition
        {
            FileName = "Test.ics",
            Inline = true,
        };

        Response.AppendHeader("Content-Disposition", cd.ToString());

        return File(calendarBytes, "text/calendar");
    }

.ics文件看起来像这样

BEGIN:VCALENDAR
PRODID:eTemida
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:eTemida_Web
METHOD:PUBLISH
X-WR-TIMEZONE:Europe/Sofia
BEGIN:VEVENT
DTSTART:20180301T140000Z
DTEND:20180301T143000Z
DTSTAMP:20180228T145800Z
UID:9358d70d-d1bf-45ea-8f40-321be757dda6
CREATED:20180228T145600Z
DESCRIPTION:eTemida
LASTMODIFIED:20180228T145600Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:eTemida
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART:20180302T123000Z
DTEND:20180302T130000Z
DTSTAMP:20180228T145800Z
UID:9cdd0d9e-891c-4b33-ada8-cf4c7b50b479
CREATED:20180228T145700Z
DESCRIPTION:eTemida
LASTMODIFIED:20180228T145700Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:eTemida
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART:20180302T140000Z
DTEND:20180302T143000Z
DTSTAMP:20180228T145800Z
UID:be32b65f-7435-4544-8c58-8068f8847345
CREATED:20180228T145700Z
DESCRIPTION:eTemida
LASTMODIFIED:20180228T145700Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:eTemida
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

我没有任何关于该做什么的提示? 是因为它是通过FTP从服务器提供的,还是来自Controller的动作的HTTP?

修改

我正在使用&#39;来自网址&#39;选项&#39;添加其他日历&#39;按钮

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

<强>解

df[,cum := cumsum(Volume)*Signal,.(rleid(Signal))]

          date Signal    Volume        cum
 1: 2016-01-04     NA  37912403         NA
 2: 2016-01-05     -1  23258238  -23258238
 3: 2016-01-06     -1  25096183  -48354421
 4: 2016-01-07     -1  45172906  -93527327
 5: 2016-01-08     -1  35402298 -128929625
 6: 2016-01-11     -1  29932385 -158862010
 7: 2016-01-12     -1  28395390 -187257400
 8: 2016-01-13     -1  33410553 -220667953
 9: 2016-01-14     -1  48658623 -269326576
10: 2016-01-15      1  46132781   46132781
11: 2016-01-19      1  30998256   77131037