+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Wrapping a binary file generator in Sitefinity access control (e.g., code to deliver a binary spreadsheet)

Wrapping a binary file generator in Sitefinity access control (e.g., code to deliver a binary spreadsheet)

1 posts, 0 answered
  1. Joshua
    Joshua avatar
    8 posts
    Registered:
    11 Apr 2013
    16 Sep
    Link to this post

    Hi All,

    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 a file?

    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!

      -Josh

1 posts, 0 answered