We have some C# code that inspects the identify of the current Sitefinity user, and generates a spreadsheet of data based on who they are. We want to allow the user to download that spreadsheet.
So, essentially what we have is C# code that generates a binary file, based on who the currently authenticated Sitefinity user is. This file is generated on the fly, and need not be stored anywhere after it has been delivered to the user.
How do you recommend I “wrap” a binary file generator/downloader
in Sitefinity? That way Sitefinity is applying the usual authentication
controls, and I can access the user’s identify from inside my code, but my code
also has complete control over the output stream, so it can deliver the bytes for
a spreadsheet, and set the content-type so that the browser will download it as
I could do this by hijacking the response with Response.Write followed by Response.End, but this doesn't "feel right." There is probably a better method that doesn't require circumventing the Sitefinity page lifecycle?
Let me know your thoughts. Thanks!