When I have spaces inside my edited web page they show up ok in the FreeTextBox control and in the html they show up as strings. However, when I read the string out of the FreeTextBox and copy that string into the space occuppied by {CONTENTS} and then display that page, the spaces become funny characters. If I look at the data coming when I do string x = FreeTExtBOx1.TExt then I see <p> </p> where I would expect to see <p> </p> etc.
Any way to make that happen?
I searched around and it seems this problem has been around awhile.
Hers's my code to read it out of the text box and copy it to my user's page:
string outputText = FreeTextBox1.Text;
string path = Request.PhysicalApplicationPath;
path += @"/Committees/CustomPageTemplate.aspx";
StreamReader sr = new StreamReader(path);
string content = sr.ReadToEnd();
string newContent = content.Replace("{CONTENTS}", outputText);
string outpath = Request.PhysicalApplicationPath;
outpath += @"/Committees/CustomPage1.aspx";
StreamWriter sw = new StreamWriter(outpath);
sw.Write(newContent);
sw.Flush();
sw.Close();
Here is the contents of the path above:
<%
@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CustomPage1.aspx.cs" Inherits="Committees_CustomPage1" Title="Untitled Page" %>
<
asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="Server">
{CONTENTS}
</
asp:Content>
Any ideas?
Thanks