locked
ASPNET PageMethods and Response.Write RRS feed

  • Question

  • Hi

    I have a simple static method in my page code-behind that generates a file.  I've gone to the effort of crafting the HttpContext.Current.Response object with the ContentType, Length etc...  When I call the Flush() method, I was expecting the File Save / Open dialog to appear.

    No dialog box appears at all, however, in the javascript method handling the success callback, I can see the contents of the file set as the result.

    How can I get the code-behind prompt the browser with a Save As dialog box.  Or is there a way in javascript to open the file in a new tab/window.

    Thanks

    Thursday, January 3, 2013 12:59 PM

All replies

  • This is really an ASP.NET question, so you'd get a better response at http://forums.asp.net.

    I believe that you need to use the "Content-Disposition" header. I don't have the details handy, but if you search for that header, you should find many examples.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    Thursday, January 3, 2013 4:38 PM
    Moderator