Download XML client-side, fetch data from Session first
<p>My goal is to have the user be able to download some information currently stored in Session. There are multiple key/value pairs in Session I would like to have the user download as one XML file.</p>

<p>The control I am working with has a client-side 'onClick' event exposed. I was planning on calling a PageMethod to extract the data I wanted from Session, and return that data to the client.</p>

<p>I've seen a very clean implementation of this in MVC and I am wondering if this clean implementation is possible in ASP.NET AJAX, as well. If not, I am wondering what the best route would be to go for this.</p>

<p>In MVC/JavaScript I see something like this:</p>

<pre><code>location.href = "../WorkOrders/Export/" + workOrderID;

public ActionResult Export(int id)
{
    WorkOrderPdfExporter exporter = new WorkOrderPdfExporter();
    byte[] buffer = exporter.Export(id);
    return File(buffer, "application/pdf", String.Format("workorder#{0}.pdf", id));
}
</code></pre>

<p>This Export method returns a FileContentResult which is an MVC thing. I am wondering if something like this exists in ASP.NET AJAX, and if the datatype is suitable to return for a Page Method.</p>

<p>If not, what should I be doing here? I was thinking about creating a dictionary, sticking the relevant session objects into this dictionary, serializing it to XML (I have a Serializable Dictionary class implemented), ...and then attempting to return that XML for download?</p>

<p>Thanks for your time.</p>
