473,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 1188
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
1
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new...
1
by: Neil | last post by:
Hi, I have an aspx page page with some existing controls code etc. This page has an update button which updates a SQL Db based on any user changes. I need to add a new section to this page and a...
1
by: Demetri | last post by:
I'm trying to determine if we want to use panels or user controls for our pages. Our primary concern is performance, page loading and posting speed. To illustrate my question, lets use the...
2
by: Yannick Turgeon | last post by:
Hello all, I'm (still) using A97. I'd like to save/export a table (a link to a SS2000 table) in dBASE 5 format, programaticly using VBA. Is that possible? I'm currently doing it by hand but...
10
by: schneider | last post by:
I'm looking for a way to programaticly call a method from a different object and associate the two objects at runtime. Example: Object A exist and is unknow, I want object B to be able to call a...
5
by: Annie | last post by:
hello guys, I have a scenario that I am confused about ... I have a number of pages which are using a Master page ... Then I have seperate Footer user control that can reside in master page...
2
by: noneya22 | last post by:
I'm using asp.net 2.0. I have a page that has a save button and a cancel button along with a text field. All controls are asp.net server controls. I have JavaScript that prompts the user if he...
1
by: zeya_bakhtyar | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.