forked from oazabir/codeuml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetDiagram.ashx
40 lines (31 loc) · 1.2 KB
/
GetDiagram.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
<%@ WebHandler Language="C#" Class="GetDiagram" %>
using System;
using System.Web;
public class GetDiagram : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string id = context.Request["id"];
// GIST solution
//GistHelper.GetGist(id);
// Tinyurl.com solution
//using (var client = new System.Net.WebClient())
//{
// var param = new System.Collections.Specialized.NameValueCollection();
// param.Add("id", id);
// var xmlDoc = System.Xml.Linq.XDocument.Load(
// new System.IO.StreamReader(
// new System.IO.MemoryStream(
// client.UploadValues("http://tny.cz/api/get.xml", param))));
// context.Response.ContentType = "text/plain";
// context.Response.Write(xmlDoc.Element("result").Element("paste").Value);
//}
var filePath = context.Server.MapPath("~/App_Data/" + id);
context.Response.ContentType = "text/plain";
context.Response.TransmitFile(filePath);
}
public bool IsReusable {
get {
return false;
}
}
}