-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputmap.ashx
More file actions
42 lines (38 loc) · 1.26 KB
/
inputmap.ashx
File metadata and controls
42 lines (38 loc) · 1.26 KB
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.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
using (var reader = new System.IO.StreamReader(context.Request.InputStream))
{
if (context.Request.UserAgent == "Allegiance")
{
try
{
string data = reader.ReadToEnd();
var user = context.Request.Headers["HTTP_USER"];
if (data.Length > 36)
{
var file = context.Request.Files[0];
file.SaveAs("inputmaps/" + user + ".7z");
context.Response.Write("OK");
}
else
{
context.Response.WriteFile("inputmaps/" + user + ".7z");
}
}
catch (Exception e)
{
context.Response.ContentType = "text/plain";
context.Response.Write(string.Format("NOPE\t\n{0}\n{1}", e.Message, e.StackTrace));
}
}
}
}
public bool IsReusable {
get {
return false;
}
}
}