How to programaticly make the user get the Save the page

G

Guest

I got a link to my .aspx page, when the link is pressed i want the user to be
able to download what the .aspx sends to it.

Inside my .aspx page i have a string called strPage, i want that strPage to
be sent to the user as a HTML page, but instead of beeing displayed, i want
the user to get Save Page button.

What headers are needed for it?
 
G

Guest

(the picture is just to illustrate what i am after, it has nothing to do
about .exe files)
 
G

Guest

i want it so when you click on the link, it executes the .aspx script that
returns thru the strResult variable to a page that you get like this:

http://www.pafo.net/dlpic.jpg

that should appear when you press the link, except that it should be named
like index.html
 
E

Emil Kvarnhammar

Why do you want exactly that dialog? That is a security warning
for vulnerable file formats. If you want the user to be able to save
the .html file to disk, then SaveAs in Javascript can be used.

I am pretty sure that there is no other way.

In similar situations, when you for example want a aspx-page to return
a dynamically created MS Excel worksheet, you'll modify the
ContentType-variable
in your WebForm. But this wouldn't have any effect in your case, since the
browser will only open the html-page in the browser the normal way, even
if you set ContentType to text/html.

regards
Emil Kvarnhammar
 
B

Bruce Barker

you control the this by the Content-Type and Content0Disposition headers.

Response.ContentType = "application/text";
Response.AddHeader("Content-Disposition", "attachment;
filename=foo.txt");

-- bruce (sqlwork.com)
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top