protected void lnkbtnSubmitReply_Click(object sender, EventArgs e) { try { if (UserId > -1) { string test = ctlAttachment.lstAttachmentIDs; string text = txtEditor.Text; string title = ""; Random random = new Random(); //Session["ATTACHMENTS_SESSION"] = int postId = -1; GetThreadTitle(out title, out postId); int newPostId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Post_Add", postId, -1, UserId, "::1", title, txtEditor.Text, false, DateTime.Now, false, PortalId, -1, false, 0, false); // http://localhost/ourspace/OpenDebates/tabid/62/forumid/1/postid/25/scope/posts/language/en-GB/Default.aspx#25 Ourspace_Utilities.View util = new Ourspace_Utilities.View(); int threadId = util.GetThreadId(newPostId); int forumId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Id_From_Thread_Id", threadId); var added = SqlHelper.ExecuteScalar(CONNECTION_STRING, "Forum_Forum_PostAdded", forumId, threadId, newPostId, UserId, "approve"); int attachmentsSession = (int)Session["ATTACHMENTS_SESSION"]; AssignAttachmentsToPost(attachmentsSession, newPostId); util.SubscribeUserToThread(threadId, forumId, UserId); //Forum.PostConnector postConnector = new Forum.PostConnector(); //List<Entities.Content.Taxonomy.Term> terms = new List<Entities.Content.Taxonomy.Term>(); //postConnector.SubmitExternalPost(TabId, 381, 0, UserId, title, txtEditor.Text, forumId, threadId, ctlAttachment.lstAttachmentIDs, "Ourspace_Texteditor:reply",threadId,terms); // ctlAttachment. //Ourspace_Utilities.View util = new Ourspace_Utilities.View(); util.SendEmailToThreadTrackers(threadId, newPostId, CultureInfo.CurrentCulture.ToString()); Session["showPostSuccess"] = true; if (Request.QueryString["threadId"] != null) { threadId = int.Parse(Request.QueryString["threadId"]); string[] parameters = new string[3] { "postId=" + newPostId, "forumId=" + forumId, "scope=posts" }; string url = DotNetNuke.Common.Globals.NavigateURL(TabId, "", parameters); //Response.Redirect(Request.Url.ToString().Replace("threadid=" + threadId, "postId=" + newPostId) + "#" + newPostId,true); Response.Redirect(url); } else if (Request.QueryString["postId"] != null) { //Response.Redirect(Request.Url.ToString().Replace("postid=" + postId, "postId=" + newPostId) + "#" + newPostId,true); string[] parameters = new string[3] { "postId=" + newPostId, "forumId=" + forumId, "scope=posts" }; string url = DotNetNuke.Common.Globals.NavigateURL(TabId, "", parameters); //Response.Redirect(Request.Url.ToString().Replace("threadid=" + threadId, "postId=" + newPostId) + "#" + newPostId,true); Response.Redirect(url); } } } catch (Exception ex) { string error = ex.Message; } }