forked from tc-radiate/tc-radiate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy.ashx
31 lines (24 loc) · 841 Bytes
/
proxy.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
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.IO;
using System.Net;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "application/json";
var url = context.Request.QueryString["url"];
var request = (HttpWebRequest)WebRequest.Create(url);
request.Accept = "application/json";
request.Headers.Add("ts", DateTime.Now.ToFileTime().ToString());
var response = request.GetResponse().GetResponseStream();
if (response == null)
return;
var reader = new StreamReader(response);
context.Response.Write(reader.ReadToEnd());
}
public bool IsReusable {
get {
return false;
}
}
}