EXISTS? Dual purpose </br> and CrLf in ONE text file?

volking used Ask the Experts™
I have a text file. The text file is sometimes viewed with a browser and sometimes viewed with a ASP.NET WinForms application.

If I use </br> the line feeds appear right in the browser but wrong in the WinForm.
If I use CrLf the line feeds appear wrong in the browser but right in the WinForm.


Any solution? Other than storing two versions of every blasted file?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You may have to save the file one way, then convert it on the fly before you display it. For example, save the file with the "</br>" tags, but find/replace them before displaying in the WinForm.

The String.Replace() function should be the one to use.
save it as </br> in the text file.

Just before loading in winforms application, read the file text in the memory and replace all </br> with Environment.NewLine



Thanks for the comments, but I already know how to work around the problem, I hoped there was a dual-purpose solution.

Problem is, I don't know (in advance) which method will be used because the file is attached to an SMTP email message. If OUTLOOK looks at it it's one result if HOTMAIL looks at it, it's another, and I have no idea which will be used to open the attached text file!
Kim WalkerWeb Programmer/Technician
This may be server specific, but if the file is served as text/plain mime type, the browser will display it as a text file, not an html file. The carriage returns will be honored as such. What is the file extension?


The ANSWER is ... Does NOT EXIST! NO dual purpose </br> and CrLf in ONE text file

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial