473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1416
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.Redire ct 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.c om> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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.Conten tType = Whatever
Response.Writef ile("c:\whateve r.doc")
Response.AddHea der("Content-Disposition", _
"inline;filenam e=whatever.doc" )
Response.End()

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<ja****@gmail.c om> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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
1888
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 range and press the button, and it compiles and sends me an excel doc right then. What I'd like is to comile and deliver a file in that manner, without saving the file to some directory and providing a link. Does anyone know how this is done?...
3
1604
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 window. Does anyone know how to get around this?
22
5695
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 recently validated my site's css and the bulk of the html pages via the W3C validator but was forced to use the file upload option because the 'Validate by URL' option returns the following error: >>Sorry, I am unable to validate this document because...
5
3140
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 have tried POSTin to be able to view the image, then saving it, but it doesnt work, the problem i have is that all the files on the server have the same name, which is http://1.1.1.1/DH/repository/content.tif and for me to be able to view one, i...
3
1723
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 server. I know there are ways to go and get a page, but this one would be dynamic and wouldn't be saved so I would need to save it while it is still active or have it forwarded to an asp.net page that will take the html code and save it to a file. TIA...
2
3990
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 below and of course it's not working properly because my web page which displays the resulting image from the database is not showing the image. I **think** the problem is in my converting the bitmap back to a byte array. If I change my code back...
11
17828
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 "included" via "Page1.htm", "Page2.htm", or "Page3.htm". The page to be "included" is specified via the QueryString which is specified in the navigational hyper links; for example, "index.php?Page1".
9
2948
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 got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
1
1692
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. Without a class / function. Fields names have no prefix and are equal to $cfg array's indexes. <input name="option_name" /> In every file of options form (e.g. main options, content options, e-
0
8372
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8814
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.