protected void uploadComment(object sender, EventArgs e) { //Get the query string parameters. string projectTitle = Session["ProjectTitle"].ToString(); int projectCode = Int32.Parse(Session["ProjectCode"].ToString()); //Create a project and look for the one we are being asked. ProjectBE project = new ProjectBE(); project.Code = projectCode; project = project.getByCode(); //If we get something different from the database, or nothing: error. //They could have change since we opened the page. if (project.Code != projectCode || project.Title != projectTitle) Response.Redirect("Error.aspx"); //We need this so we get the nickname and we do not show the user's email to the public. UserBE writer = new UserBE(); writer.Email = Session["UserEmail"].ToString(); writer = writer.getUserByEmail(); //Now we get the dateTime DateTime creationDate = DateTime.Now; //And the message content. String message = commentProjectText.Text; //Comment creation CommentBE crComment = new CommentBE(writer, project, creationDate, message); crComment.create(); //Reload the page with the added comment. Response.Redirect(Request.RawUrl); }