public DiyPage(string title, string content) { Page = new StringBuilder(); string pagestr = DoIo.Reader(DoIo.ApppDatapath + @"txt.html").Replace("<title></title>", "<title>" + title + "</title>"); pagestr = pagestr.Replace("<div id='content'>", "<div id='content'>" + content); Page.Append(pagestr); }
protected void Button1_Click(object sender, EventArgs e) { string title = "Test"; string s = FreeTextBox1.Text; if (!string.IsNullOrEmpty(TextBox1.Text.Trim().ToString())) { title = TextBox1.Text.Trim(); } DoIo.Create(DoIo.Apppath + @"\file\text\" + title + @" .html", new DiyPage(title, s).GetPageStr()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString.Count > 0) { if (Request.QueryString["txt"].Length > 0) { string text = DoIo.Reader(Server.MapPath(Request.QueryString["txt"].ToString())); text = text.Remove(1, text.IndexOf("<div id='content'>")); text = text.Replace("</body>", ""); text = text.Replace("</html>", ""); FreeTextBox1.Text = text; } if (Request.QueryString["title"].Length > 0) { TextBox1.Text = Request.QueryString["title"].ToString(); } } } }