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

A

Andyza

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?
 
A

Anthony Jones

Andyza said:
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;")
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top