Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Essentially there are four things you would want to do:</p> <ol> <li>Clear anything currently in the Response buffer. A call to <code>Response.Clear();</code> will take care of this.</li> <li>Set the appropriate response headers. In the case of wanting to return a downloadable file, you'd set the <code>content-disposition</code> header as such: <code>Response.AddHeader("content-disposition", "attachment; filename=somefile.html");</code> (Where "somefile.html" is the name to suggest that the browser use for saving the file. It can be hardcoded or a dynamic value, that's up to you.) This is the standard way to suggest to a browser that it should save the file. I say "<em>suggest</em>" because it's not required. Understand that HTTP has no concept of "files." Only requests and responses. What you're doing with this header is telling the browser that the data stream you're sending it should be saved as a file. It's highly likely that the browser will comply with this.</li> <li>Write the data. <code>Response.Write();</code> is the usual way to do this.</li> <li>End the response (so the browser can be signaled that it's received everything). <code>Response.End();</code> does this.</li> </ol> <p>Take a look at the other options available on <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx" rel="nofollow">the HttpResponse class</a>, though. There are even methods called <code>WriteFile()</code> which may make the code even simpler. I'm not familiar with them, so I can't really give an example.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload