rendered paste bodyStringBuilder sb = new StringBuilder(215);
sb.AppendFormat("BEGIN:VCALENDAR{0}", Environment.NewLine);
sb.AppendFormat("CALSCALE:GREGORIAN{0}", Environment.NewLine);
sb.AppendFormat("VERSION:1.0{0}", Environment.NewLine);
sb.AppendFormat("BEGIN:VEVENT{0}", Environment.NewLine);
sb.AppendFormat("DTSTART:20080703T093000{0}", Environment.NewLine);
sb.AppendFormat("DTEND:20080703T113000{0}", Environment.NewLine);
sb.AppendFormat("LOCATION:testing some locationşş{0}", Environment.NewLine);
sb.AppendFormat("SUMMARY:Testing Some subject{0}", Environment.NewLine);
sb.AppendFormat("CLASS:PUBLIC{0}", Environment.NewLine);
sb.AppendFormat("END:VEVENT{0}", Environment.NewLine);
sb.AppendFormat("END:VCALENDAR{0}", Environment.NewLine);
UTF8Encoding enc = new UTF8Encoding();
byte[] arrBytData = enc.GetBytes(sb.ToString());
Response.Clear();
Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition", "attachment; filename=vCalendar.ics");
Response.AppendHeader("Content-Length", arrBytData.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(arrBytData);
Response.Flush();
Response.End();