Very simple to create vCalendar files, it is basically like creating text files, the only difference is the format.
In this example, a physical file is not created (no need to clean up a temp directory afterwards), the file is kept in memory using memory stream. Once the file is created in memory, it is sent for download.
vCalendar is using UTC, so the function
ToUniversalTime is used to convert the local time to UTC.
<%@ Page Language="vb" ContentType="text/html"
ResponseEncoding="iso-8859-1" Debug="False" trace="False"%>
<%@ import Namespace="System.IO" %>
Sub Page_Load(Sender As Object, E As EventArgs)
Dim beginDate as Date = #01/07/2005 4:00 PM#
Dim endDate as Date = #01/07/2005 6:00 PM#
Dim myLocation as String = "Computer Room"
Dim mySubject as String = "Training"
Dim myDescription as String = "Event details"
Dim mStream As new MemoryStream()
Dim writer As new StreamWriter(mStream)
writer.AutoFlush = true
writer.WriteLine("DTSTART:" & _
writer.WriteLine("DTEND:" & _
writer.WriteLine("LOCATION:" & myLocation)
writer.WriteLine("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & myDescription)
writer.WriteLine("SUMMARY:" & mySubject)
Response.Clear() Response.AppendHeader("Content-Disposition", _
Response.ContentType = "application/download"
Broad engineering background with business knowledge (graduated from a top French engineering school training entrepreneurs), and excellent relationship skills that Flo utilizes in the I.T. field to streamline/improve company processes.
From web to embedded programming, from a big-5 consulting company to a local hospital, Flo shares his time between development and implementation lead.
Work with ASP.NET, VB.NET, LDAP, SQL Server, Oracle, MySQL...