Response.AddHeader problem when using Javascript as the server-side scripting language

Discussion in 'ASP General' started by Andyza, Feb 16, 2007.

  1. Andyza

    Andyza Guest

    With reference to the ASPFAQ 2161 article -
    http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html

    Does the 'Content-Disposition' code work if the user is using
    JAVASCRIPT as the SERVER SIDE scripting language, i.e.:

    <%@LANGUAGE=JAVASCRIPT%>

    If I add this header to a page that uses Javascript as the server-side
    scripting language:

    Response.ContentType = "application/save"
    Response.AddHeader "Content-Disposition: attachment;
    filename=MySpreadsheet.xls;"

    Then the page crashes with:

    Microsoft JScript compilation (0x800A03EC)
    Expected ';'
    /myform.asp, line 8, column 19
    Response.AddHeader "Content-Disposition: attachment;
    filename=MySpreadsheet.xls;"

    Line 8, column 19 is:
    Response.AddHeader "Content-Disposition: attachment;
    filename=MySpreadsheet.xls;"

    It looks like IIS doesn't like something in the "Content-Disposition:
    attachment; filename=MySpreadsheet.xls;" part of line 8 - probably a
    Javascript syntax thing.

    How can I fix it?
    Andyza, Feb 16, 2007
    #1
    1. Advertising

  2. "Andyza" <> wrote in message
    news:...
    > With reference to the ASPFAQ 2161 article -
    >

    http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html
    >
    > Does the 'Content-Disposition' code work if the user is using
    > JAVASCRIPT as the SERVER SIDE scripting language, i.e.:
    >
    > <%@LANGUAGE=JAVASCRIPT%>
    >
    > If I add this header to a page that uses Javascript as the server-side
    > scripting language:
    >
    > Response.ContentType = "application/save"
    > Response.AddHeader "Content-Disposition: attachment;
    > filename=MySpreadsheet.xls;"
    >
    > Then the page crashes with:
    >
    > Microsoft JScript compilation (0x800A03EC)
    > Expected ';'
    > /myform.asp, line 8, column 19
    > Response.AddHeader "Content-Disposition: attachment;
    > filename=MySpreadsheet.xls;"
    >
    > Line 8, column 19 is:
    > Response.AddHeader "Content-Disposition: attachment;
    > filename=MySpreadsheet.xls;"
    >
    > It looks like IIS doesn't like something in the "Content-Disposition:
    > attachment; filename=MySpreadsheet.xls;" part of line 8 - probably a
    > Javascript syntax thing.
    >
    > How can I fix it?
    >


    All procedures are functions in JScript all calls must use ( )

    Try:-

    Response.AddHeader("Content-Disposition: attachment;
    filename=MySpreadsheet.xls;")
    Anthony Jones, Feb 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph
    Replies:
    2
    Views:
    5,567
  2. S.Kartikeyan
    Replies:
    0
    Views:
    2,761
    S.Kartikeyan
    Mar 1, 2004
  3. =?Utf-8?B?SW5jb3JyZWN0IGZpbGVuYW1lcyBpbiBkb3dubG9h

    Problem with filenames in response.addheader()

    =?Utf-8?B?SW5jb3JyZWN0IGZpbGVuYW1lcyBpbiBkb3dubG9h, Oct 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    522
    Rob Meade
    Oct 28, 2005
  4. DaveInSidney
    Replies:
    0
    Views:
    393
    DaveInSidney
    May 9, 2005
  5. Bertrand

    Using response.addheader for pushing file

    Bertrand, Nov 11, 2003, in forum: ASP General
    Replies:
    0
    Views:
    108
    Bertrand
    Nov 11, 2003
Loading...

Share This Page