click to download

G

Guest

Can I have this function?
When a user click on a link, my ASP page generates a text file call test.txt
containing a string of "This ia s test msg.", and then a download dialogue
appears.
Any reference for me?
Thanks in advance.
 
A

Anthony Jones

Can I have this function?
When a user click on a link, my ASP page generates a text file call test.txt
containing a string of "This ia s test msg.", and then a download dialogue
appears.
Any reference for me?
Thanks in advance.

How's this:-

<%
Response.CodePage = 950 ' Change to prefered codepage
Response.ContentType = "text/plain"
Response.CharSet = "big5" 'Change to Charset matching codepage
Response.AddHeader "attachment; filename=test.txt"
Response.Write "This is a test msg"
%>
 
G

Guest

Anthony, thanks a lot for your help.
I have tried it by adding your code to my empty ASP file, however, it
displayed an error 500 page. Did I do something wrong?
 
A

Anthony Jones

Anthony, thanks a lot for your help.
I have tried it by adding your code to my empty ASP file, however, it
displayed an error 500 page. Did I do something wrong?

IIS5 (Win2000) or IIS6 (Win2003)?

Edit your application configuration properties and enable detailed error ASP
error messages.
IIS Manager -> You application folder -> Propeties -> Home
Directory ->Configuration...-> App Debugging -> Send detailed ASP error
messages to client.

What do you get back now?
What is the system codepage of the server you are using?
 
G

Guest

IIS5.
How can I know the system codepage of my server?
The followings are the technical information.

Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment:
'Response.AddHeader'
/test.asp, line 5


Browser Type:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR
2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)

Page:
GET /test.asp
 
A

Anthony Jones

IIS5.
How can I know the system codepage of my server?
The followings are the technical information.

Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment:
'Response.AddHeader'
/test.asp, line 5

That's my fault not being careful with the typing that line should read:-

Response.AddHeader "Content-Disposition", "attachment; filename=test.txt"
 
G

Guest

It works perfectly, Anthony. You help me a lot. Thanks again for your kindly
intention.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top