I have to implement something like proxy in mvc to send user file that is on another server . I found this class :
public class ProxyHandler : IHttpHandler, IRouteHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
string str = "http://download.thinkbroadband.com/100MB.zip";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(str);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
HttpResponse res = context.Response;
res.Write(reader.ReadToEnd());
}
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return this;
}
}
The problem is in this solution i first download file and then send downloded file to user with is not what i want. I want to send file to user as soon as I start to download it like in this Online Anonymizer for example http://bind2.com/
Any suggestions how to achieve this?