Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7434629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:55:26+00:00 2026-05-29T09:55:26+00:00

I have an issue i’m trying to output textfile text in html however I

  • 0

I have an issue i’m trying to output textfile text in html however I want the same format in the html output to match the textfile format. So example in my textfile i have this:

Hello Test, Settings:    
Setting = Value //The setting to be set

Testing this:

Esse meis has in, in per suavitate ocurreret. Eu quo homero fabulas democritum. Dico oblique
veritus quo ad, unum saepe eirmod te sed, ius vidit vidisse cu. Eu quis omnis viris ius.

Nam falli decore ei. Eos aliquip mentitum persequeris no. Nec gubergren contentiones cu, ea quo
autem nostrud. Mea ex primis probatus, tempor vocent pertinacia ex est. Volumus oportere usu cu,
clita facete perfecto ea has, nam eu unum everti inimicus.

NOTICE how its formatted with spaces and new paragraph in my textfile. Here is my code..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.IO;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String line; StringBuilder sp = new StringBuilder();
            using (StreamReader sr = new StreamReader("TextFile1.txt")) //PATH WHERE YOU HAVE STORED THE TEXT FILE
            {

                // Read and display lines from the file until the end of
                // the file is reached.
                while ((line = sr.ReadLine()) != null)
                {
                    sp.Append(line);
                }

            }
            dvText.InnerText = sp.ToString();
        }
    }
}

FRONT END code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1"
    ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="dvText" runat="server">

    </div>
    </form>
</body>
</html>

When I run it i get wrong format.. which is my problem.. output below..

Hello Test, Settings:[Username] //What is your usernameSetting = Value
//The setting to be setTesting this:Esse meis has in, in per suavitate
ocurreret. Eu quo homero fabulas democritum. Dico obliqueveritus quo
ad, unum saepe eirmod te sed, ius vidit vidisse cu. Eu quis omnis
viris ius.Nam falli decore ei. Eos aliquip mentitum persequeris no.
Nec gubergren contentiones cu, ea quoautem nostrud. Mea ex primis
probatus, tempor vocent pertinacia ex est. Volumus oportere usu
cu,clita facete perfecto ea has, nam eu unum everti inimicus.

As you can see it formats it wrong can anyone help me been trying to solve this issue for ages..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:55:27+00:00Added an answer on May 29, 2026 at 9:55 am

    Try to put the content inside a <pre>tag<pre>.

    This notifies the browser that the content is preformatted and respects the new lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this issue that I want to resolve. Lets think we have this
I have issue wuth Firefox not displaying style text-decoration: line-through. I am using jqGrid
Im writing sql query and i have issue which i cannot fix. I'm trying
I have issue where i want to create Dynamic function which will do some
I have issue with a value that should have just work, however, it seem
I have an issue that I've spent hours trying to figure out, but since
I have an issue with my divs. I currently have four divs in html
I have issue with url rewrite. I have a site example.com that has a
I have issue with showing some content in div. I have some text consider
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.