我先贴出我的代码来吧。我的代码如下:(如果没有更好的解决方案的话,我不会给分的哦)这个代码的缺点是如果将内容放入表格里面不好控制,我还没有想好,大家帮忙啊!
<%@ Page Language="vb" %>
<%@ import Namespace="System.IO" %>
<script runat="server">    Sub SendButton_Click ( sender as Object, e as EventArgs )
            Dim output1 As TextWriter = File.AppendText(Server.MapPath("STORY.txt") )
             Dim line As String
             line = NextLine.text
             output1.WriteLine(line)
             output1.Close()
    end sub
    Sub Page_Load(Sender As Object, E As EventArgs)
            Dim input1 As TextReader = File.OpenText(Server.MapPath("STORY.txt"))
             Dim line As String
            line = input1.ReadLine()
              While Not (line Is Nothing)
                Response.Write ("<br>" & line )
                line = input1.ReadLine()
             End While
             input1.Close()
    end sub</script>
<html>
<head>
    <title>在线故事接龙</title>
</head>
<body bgcolor="green">
    <center>
        <h2>在线故事接龙 
        </h2>
    </center>
    <hr />
    <h3>请输入故事的新行
    </h3>
    <form action="story.aspx" method="post" runat="server">
        <asp:textbox id="NextLine" runat="server" size="70" TextMode="MultiLine" Columns="50"></asp:textbox>
        <asp:button id="Write" onclick="SendButton_Click" runat="server" Text="添加"></asp:button>
    </form>
</body>
</html>
  小东西,大家见效了!

解决方案 »

  1.   

    哈,这不是问题,最关键的问题是每一段开头的空格,也被我给替换掉了。
      But thank you all the same.
      

  2.   

    用textbox 属性设 MultiLine,然后读取它的innerhtml,保存时也用这个值,不需修改即可保存原格式的
      

  3.   

    精简后的代码为:
    <%@ Page Language="vb" %>
    <%@ import Namespace="System.IO" %>
    <script runat="server">
           Sub Page_Load(Sender As Object, E As EventArgs)
                Dim input1 As TextReader = File.OpenText(Server.MapPath("STORY.txt"))
                 Dim line As String
                line = input1.ReadLine()
                  While Not (line Is Nothing)                Response.Write ("<br>" & line )                line = input1.ReadLine()
                 End While
                 input1.Close()
        end sub</script>
    <html>
    <head>
        <title>读取文本文件按照其原有格式换行</title>
    </head>
    <body bgcolor="green"></body>
    </html>
      

  4.   

    用紫光辨识工具辨识后另存为rtf文件就可以去掉回车符了,不知有没有分啊
      

  5.   

    哦,是吗?are you sure?我去试试看,不过程序上的问题还没有解决哦。