public void createMatch_Click(object sender, EventArgs e) { Matches match = new Matches(); bool isCreated = match.createMatch(matchName.Text, matchType.Text, selectedId.Value, matchDate.Text, matchTime.Text, Session["userid"].ToString()); if (isCreated) { if (match.type == "Private") { Response.Redirect("~/MatchRoom.aspx?match_id=" + match.id + "&type=" + match.type + "&code=" + match.getPvtMatchCode(match.id)); } if (match.type == "Public") { Response.Redirect("~/MatchRoom.aspx?match_id=" + match.id + "&type=" + match.type); } Response.Redirect("~/MatchRoom.aspx?match_id=" + match.id + "&type=" + "WRONG"); } // should be relocated to my matches page }