-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathEchoHandler.ashx
42 lines (36 loc) · 1.33 KB
/
EchoHandler.ashx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.IO;
using System.Web;
public class Handler : IHttpHandler {
/*
* The purpose of this file is to echo form data back to a client app.
* The echo includes a header type of csv. And it is intended to trigger
* a Save-as dialog box on the client.
*
* HINT: if you get an error trying to use this file, check your extension
* mappings in IIS.
*
*/
public void ProcessRequest (HttpContext context)
{
//Set an input condition. It provides a basic level of security, and you can
//use this to set up multiple types of responses based on an input parameter.
String check = context.Request.QueryString["check"];
if (check == "true")
{
string title = context.Request.Form["title"];
String formData = context.Request.Form["hiddenInput"];
context.Response.ContentType = "text/csv";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.AddHeader("content-disposition", "attachment; filename=ejscreen.csv");
context.Response.Write(title);
context.Response.Write(formData);
}
}
public bool IsReusable {
get {
return false;
}
}
}