Hello How to use query string with session in asp.net I am working on a website containing a form which must be filled by the users. In the first page, the users by clicking the register button is referred to the second page where the user will be required to complete the registration process. Now my question is that how can I make it possible that when a user submits the register button in the first page must be the same user in the second page, means that the same user must be displayed in the dropdown list of the second page which is done by query string? As an example, below are codes which may help you better understand my question Page 1 try { con.Open(); cmdin.ExecuteNonQuery(); cmdin.Parameters.Clear(); LabelSuccsessful.Visible = true; LabelSuccsessful.Text = "Registration was sucessfully"; //Session["Person_TB"] = TextBox_PersonName; //Response.Redirect("~/EducationPersons.aspx?pid="+XXXXXX); } catch { LabelSuccsessful.Visible = true; LabelSuccsessful.Text = "Registration was failed try again"; } finally { con.Close(); con.Dispose(); }//---------------------------------- Page 2 //---------------show the name of user string strcmd = "Select Person_Name from Person_TB where Person_ID=@piid"; SqlCommand cmd = new SqlCommand(strcmd, con); cmd.Parameters.Clear(); con.Open(); //cmd.Parameters.AddWithValue("@iid", Request.QueryString["pid"]); SqlDataReader dr; dr = cmd.ExecuteReader(); while (dr.Read()) { LabelpersWelcom.Text = "Welcome Dear"; LabelWEduPerson.Text = dr["Person_Name"].ToString(); // DropDownListPersonName.SelectedValue = dr["Person_Name"].ToString(); } con.Close();//---- }//-------end of PageLoad
if(Session["Person_TB"] == null) // Redirect To Error Page
// user can change Query String Value if(dr["Person_Name"].ToString() == Session["Person_TB"].ToString()) // LabelWEduPerson.Text = dr["Person_Name"].ToString(); else // Redirect To Error Page
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)