471,306 Members | 868 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

How to programaticly make the user get the Save the page

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?
Nov 19 '05 #1
5 1112
If I understand your question correctly, the easiest way is probably to use
SaveAs from Javascript.

Check out: http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4052

regards
Emil Kvarnhammar
http://www.ynax.com

"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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?

Nov 19 '05 #2
(the picture is just to illustrate what i am after, it has nothing to do
about .exe files)

"Emil Kvarnhammar" wrote:
If I understand your question correctly, the easiest way is probably to use
SaveAs from Javascript.

Check out: http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4052

regards
Emil Kvarnhammar
http://www.ynax.com

"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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?


Nov 19 '05 #3
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

"Emil Kvarnhammar" wrote:
If I understand your question correctly, the easiest way is probably to use
SaveAs from Javascript.

Check out: http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4052

regards
Emil Kvarnhammar
http://www.ynax.com

"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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?


Nov 19 '05 #4
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

"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
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

"Emil Kvarnhammar" wrote:
If I understand your question correctly, the easiest way is probably to
use
SaveAs from Javascript.

Check out: http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=4052

regards
Emil Kvarnhammar
http://www.ynax.com

"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
>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?


Nov 19 '05 #5
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)
"Patrick F" <Pa******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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?

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Robert Howells | last post: by
1 post views Thread by Demetri | last post: by
2 posts views Thread by Yannick Turgeon | last post: by
5 posts views Thread by Annie | last post: by
1 post views Thread by zeya_bakhtyar | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.