Posted By

krisdb on 01/08/09


Tagged

c-sharp


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
tschloss
shailensukul


VCal


 / Published in: C#
 

  1. Response.AppendHeader("content-disposition", "attachment; filename=Calendar.vcs");
  2. Response.ContentType = "text/x-vcalendar vcs";
  3. Response.Charset = "utf-8";
  4. Response.ContentEncoding = System.Text.Encoding.UTF8;
  5. Response.Write("BEGIN:VCALENDAR\n");
  6. Response.Write("PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN\n");
  7. Response.Write("VERSION:1.0\n");
  8. Response.Write("BEGIN:VEVENT\n");
  9. Response.Write("DTSTART:" + strStartDate + "\n");
  10. Response.Write("DTEND:" + strEndDate + "\n");
  11. Response.Write("LOCATION;ENCODING=QUOTED-PRINTABLE:" + strLocation + "\n");
  12. Response.Write("TRANSP:1\n");
  13. Response.Write("UID:040000008200E00074C5B7101A82E00800000000907848358ACDC5010000000000000000100000007E1B76A09767384396CC5B0B41C6B678\n");
  14. Response.Write("SUMMARY;ENCODING=QUOTED-PRINTABLE:" + strSummary.Replace("'", "'") + " \n");
  15. Response.Write("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + VCalClean(strDesc) + "\n");
  16. Response.Write("END:VEVENT \n");
  17. Response.Write("END:VCALENDAR \n");
  18. Response.End();
  19.  
  20. private string VCalClean(string rawString)
  21. {
  22. string output = rawString;
  23.  
  24. output = StripHTML(output);
  25.  
  26. output = output.Replace("\r", "");
  27. output = output.Replace("\n", "");
  28. output = output.Replace("\t", "");
  29.  
  30. return output;
  31. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: shailensukul on May 22, 2012

Where is StripHTML defined?

You need to login to post a comment.