473,412 Members | 2,284 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,412 software developers and data experts.

Saving content of dynamic page

I have an asp.net web page that:

1. Shows a message
2. Posts back (using javascript)
3. Reads contents of a file
4. response.write the contents of the file to the browser

My issue is this: If a user hits this page and decides to save the
page for offline browsing, they are not saving the output of the
response.write, but instead the html that shows the message and calls
the refresh.

How can I allow the user to save the current content of the page,
without hitting the server again for the dynamically created content?

Thanks in advance,

Jay

Nov 19 '05 #1
3 1407
Interesting problem Jay. Haven't encountered that one before. I think the
problem is related to the fact that the page, after PostBack is a Form
results page (as far as the browser knows). So the browser requests the page
afresh. A possible workaround would be to put the contents of the file (a
text file?) into a Session variable, and create a second page that displays
the contents of the Session variable. Then Response.Redirect to the second
page. This would enable the browser to make a fresh request for the second
page, which would then reload the text from the Session variable and display
it as you want it to be saved.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

<ja****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have an asp.net web page that:

1. Shows a message
2. Posts back (using javascript)
3. Reads contents of a file
4. response.write the contents of the file to the browser

My issue is this: If a user hits this page and decides to save the
page for offline browsing, they are not saving the output of the
response.write, but instead the html that shows the message and calls
the refresh.

How can I allow the user to save the current content of the page,
without hitting the server again for the dynamically created content?

Thanks in advance,

Jay

Nov 19 '05 #2
Maybe you can use some code like this:

Response.Clear()
Response.ContentType = Whatever
Response.Writefile("c:\whatever.doc")
Response.AddHeader("Content-Disposition", _
"inline;filename=whatever.doc")
Response.End()

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<ja****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I have an asp.net web page that:

1. Shows a message
2. Posts back (using javascript)
3. Reads contents of a file
4. response.write the contents of the file to the browser

My issue is this: If a user hits this page and decides to save the
page for offline browsing, they are not saving the output of the
response.write, but instead the html that shows the message and calls
the refresh.

How can I allow the user to save the current content of the page,
without hitting the server again for the dynamically created content?

Thanks in advance,

Jay

Nov 19 '05 #3
Right on Kevin! Worked like a charm. Thanks for your help.

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AaronV | last post by:
I've seen a few sites that offer this, but I'm not sure how they do it. It's a form button, that when pressed, prompts the use to download a file. Like if I want my banking records, I select a date...
3
by: James | last post by:
Situation: I have a page, built using document.write(). When I hit 'save as', IE goes and saves the contents of 'about:blank' to that file, rather than saving the HTML it's displaying in the...
22
by: Trevor Orton | last post by:
Hello, I'm having a slight problem using the W3C html validator and I've reviewed the FAQ's with no luck so hopefully someone here would be kind enough to point me in the right direction. I...
5
by: Thaynann | last post by:
I have an app that (at the moment) moves through files that are on a web site, and deletes them, wat i want to do for the next stage, is to be able to download each file before i delete it. i...
3
by: Clay Black | last post by:
I need to find a way to save an HTML page to the IIS server. What I need is to have a button that once it is clicked the current page being displayed is saved to a location on the local IIS...
2
by: Brad | last post by:
I have code which takes an image, uploaded from a web page, and saves it to a database. Now I want to always resize an uploaded image before it is saved to the database. My code to resize is...
11
by: McKirahan | last post by:
I am looking for feedback on an approach to using PHP. Below is a stripped down version of a Home page: "index.php". The content of the site is displayed in the middle of the page and is...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
1
by: WebCM | last post by:
We can do it in different ways. Configuration data are sent by POST. Some of them should be parsed before saving to file. Perhaps, I will use var_export(). However, how to do it best? 1....
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.