How to write HttpWebRequest response to browser

I am trying to achieve this:

  • I have a website from where users buy files and then they see the download links.
  • Files are located on another location (some www.myfiles.com) the links are secure so the users dont see where are the files but actually the browser should start downloading the files as soon as they click.
  • user buy files, click on the link and i do this:

    var filename = "SomeHighlySecureFile.mp3"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://myfiles.com/download.aspx?file=" + filename); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream();

    context.Response.Buffer = true; context.Response.Clear(); context.Response.AddHeader("content-disposition", "attachment; filename=" + fileinfo.Name); context.Response.ContentType = "application/octet-stream";

  • I have no idea, what to do next? coz the "WriteFile" does not provide the options to write another stream?

    Can anyone give me a clue how to do that?

    链接地址: http://www.djcxy.com/p/45896.html

    上一篇: 在solr上获得错误的请求(400)

    下一篇: 如何编写HttpWebRequest响应到浏览器