Skip to content

Instantly share code, notes, and snippets.

@FrozenCow FrozenCow/up.aspx
Created Jun 3, 2011

Embed
What would you like to do?
<%@ Page Language="C#" %>
<script runat="server" language="C#">
public void Page_Load(object sender, EventArgs e)
{
try
{
string path = Request.Params["path"];
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://localhost:8123/up/" + path);
request.Method = Request.HttpMethod;
request.ContentType = Request.ContentType;
if (Request.ContentLength > 0)
{
using (System.IO.StreamReader reader = new System.IO.StreamReader(Request.InputStream))
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(request.GetRequestStream()))
{
writer.Write(reader.ReadToEnd());
}
}
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream responseStream = response.GetResponseStream();
Response.StatusCode = response.StatusCode;
Response.StatusDescription = response.StatusDescription;
Response.ContentType = response.ContentType;
using (System.IO.StreamReader reader = new System.IO.StreamReader(responseStream))
{
Response.ContentType = response.ContentType;
Response.Write(reader.ReadToEnd());
reader.Close();
responseStream.Close();
response.Close();
}
} catch (Exception ex) {
Response.Write(ex.ToString());
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.