private void CreateBlog() { if (!Validation()) return; string title = txtTitle.Text.Trim(); string permalink = txtPermalink.Text.Trim(); string tags = txtTag.Text.Trim(); string content = txtContent.Text; //.Replace("\r\n", "<br />") DateTime postTime = DateTime.Parse(txtPostTime.Text); Blog b = new Blog() { Author = Master.LoginName, Title = title, Permalink = permalink, CategoryId = Convert.ToInt32(ddlCategory.SelectedValue), Tags = tags, Content = content, PostDate = postTime, Visibility = (BlogVisibility) Convert.ToInt32(ddlVisibility.SelectedValue) }; // To do, Blog created, Blog_ID return, then I load this blog again just for loading Category, // This is extremly stupid! int blogId = 0; b.Create(out blogId); b = Blog.LoadById(blogId); b.HyperLink = WebUtil.GetBlogHyperLink(b.Id); // 1. Update feeds XML FeedsManager.AddItem(b); // 2. Rebuild Cache RebuildCache(); // 3. Update Sitemap UpdateSiteMap(b, String.Empty); Response.ClearContent(); Response.Write("<script>alert('发表成功^_^');document.location ='" + WebUtil.BaseUri + "';</script>"); Response.End(); }