protected void ButtonAddComment_Click(object sender, EventArgs e) { if (Request.Cookies["AuthCookie"] != null) { database.StartConnection(); string UserName = (FormsAuthentication.Decrypt(Request.Cookies["AuthCookie"].Value).Name); database.AddComment(UserName, CommentTextArea.InnerText, database.GetPost(Int32.Parse(Request.QueryString["CurrentPost"])).PostId); database.CloseConnection(); Response.Redirect("~/WebForms/ViewPost?CurrentPost=" + Int32.Parse(Request.QueryString["CurrentPost"])); } else { Response.Redirect("~/WebForms/LogIn.aspx"); } }