473,753 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

save text file (stream) as html

a
Save text file as html kloepper 17:42 23 Jul '04
I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags.
eg.,

<table cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<tr>
<td width="48%"></td>
<td vAlign=bottom width="5%"><FON T
face="Times New Roman" size=1><B> Howdy!! </B></FONT></td>
<td width="47%"></td></tr>
</TBODY></table>

When I copy, paste and save the returned file from the textbox (txtOutput)with a .html extension, the file opens as a normal looking html file, but when I try to save the stream with an html suffix with the following code, something changes in the file and instead of opening as a normal html file, I instead get what looks like a text file with strikethrough font in numerous places...eg., <strike>Howdy !!</strike>

// Save File-----------------------------------
StreamWriter writer = new StreamWriter(se c_save);
writer.WriteLin e(txtOutput.Tex t.ToString());
writer.Close();

The StreamWriter gets its input from a textbox (txtOutput) that has been populated by a StringBuilder (the html tags in the original text file have actually been converted to an XHTML file, ie well-formed html tags.)

I can supply the code that converts the html to xhtml if needed...

Basically, I'm just trying to find a way to save the stream as an .html file and have it open as any other html file would open, without the strikethroughs.

A different way to save the stream perhaps?

Thanks,

Paul

Nov 16 '05 #1
0 6436

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

Similar topics

0
1939
by: Michael | last post by:
I have a problem forcing files to download. If I select Save the document is saved with no problems. If I select "Open" the document is empty or I get a "File not found" error from the application opening the file... Code: function UTIL_ForceDownloadFile(strFileName, strFileSaveName) Response.Buffer = True Dim strFileSize Const adTypeBinary = 1
2
13099
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0" encoding="UTF-8"?><a>some info</a>"; I want to save this xml file to local file system with JavaScript,
9
3029
by: Ivan Demkovitch | last post by:
Hi! I would like to know if I can save File on Server using server-side code? For example, I like to create thumbnail images and populate specific directory. Do I need specific permissions to do this? (I use public host) Thanks!
4
2848
by: David W. Simmonds | last post by:
Is there a way I can have a button on a ASP.NET form that when clicked will allow the user to save the image to a file on the client side? I know that the user can simply rclick the image and select Save Target as..., but the button might be a more intuitive way.
0
2979
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
2
2839
by: Dave | last post by:
Hello. I need to load an URL and save it to a file in Asp.Net. The function below is creating the file, but isn't putting the data in it. Also the data is binary, so I'm not sure if I need to fiddle with encoding or whatnot. Dave Private Function GetURLSave(ByVal sURL As String,ByVal sFileName As String) As Boolean Dim oRequest As System.Net.HttpWebRequest =
8
2698
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they choose) on the users / client file system. I have toyed with a Self-Extracting zip file but the contents of my zip file changes each time it is downloaded so that invalidates the exe file. Also the text file is so small it is a waste to zip it.
4
10247
by: Dale | last post by:
I am creating GIF images with transparent backgrounds on-the-fly for a web app and rendering them by using System.Drawing.Image.Save(Response.OutputStream, ImageType.GIF). I am confident that the transparency is working properly because if I save the created image to the local hard disk and then view it in a web page or an image editor, the transparency is correct. I can also view the transparency on-the-fly in a Windows.Forms...
12
4773
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page on the client's computer? He/she could do this using the browser (file/save), but I need to have it done by pressing the pushbutton. In my serverside code I get the button-click-event, I also know how to get
0
9113
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
9706
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...
0
9503
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9474
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
9377
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...
0
4983
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3439
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2324
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.