Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a form which accepts start time,end time,start and end date,location and description for conference room booking.
On a button click i have set the code to create and .ics file which will generate and outlook file which will eventually book an appointment in my outlook calender for future reminder.
The problem is that the code only accepts static or predefined data for start time,endtime,date and etc.How can i bind the data that the user has selected from the form?

What I have tried:

C#
public void ProcessRequest(HttpContext context)
    {

        StringBuilder str = new StringBuilder();        
        
      context.Response.Clear();
      context.Response.Charset = "";
      context.Response.ContentType = "text/calendar";
      context.Response.AddHeader("Content-Disposition", "inline; filename=\\Calender.ics");
      context.Response.BinaryWrite(new System.Text.ASCIIEncoding().GetBytes(@"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
DTSTART:20120515T113000Z

DTEND:20120515T113000Z
LOCATION:office
UID:040000008200E00074C5B7101A82E00800000000E09778CC8A2FCD01000000000000000
	010000000A616AC829938554DA102762D344287C7
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=
=0D=0A
SUMMARY:calander
PRIORITY:3
END:VEVENT
END:VCALENDAR"));
        //Response.Write(); 
        context.Response.End();
    }
Posted
v2

1 solution

Send QueryString to the call to ashx file. Get QueryString values like below inside the block and do whatever you want to do.
C#
string ID = context.Request.QueryString["ID"];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900