Hello Sir,
I have login page, using this we can login to admin as well as builder panel. In builder panel I have to show particular login builder id and it firm name should print on label present in master page.
I achieved it though query string, but when i choose another page from menu bar like dashboard page or any other page then i lost that query string as well as label information form master page.
As my content page is connected to master page then think above logic should apply to only master page and i can't do anything in contact page as those labels are not available in content page.
Please find my html and C# coding and help me with this.
public partial class login_Default : System.Web.UI.Page
{
SqlConnection cn;
SqlCommand cm;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ }
}
protected void login_click(object sender, EventArgs e)
{
string type;
register R1 = new register();
string cs = R1.connection();
cn = new SqlConnection(cs);
cn.Open();
cm = new SqlCommand("login1", cn);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.AddWithValue("userid1", username.Text);
cm.Parameters.AddWithValue("password1", password.Text);
dr = cm.ExecuteReader();
if (dr.Read())
{
type = dr["role"].ToString();
if (type == "admin")
{
Response.Redirect("../admin/Default.aspx");
}
if (type == "BUILDER")
{
Response.Redirect("../Builder/Default.aspx?buildid="+password.Text);
}
}
else
{
Response.Write("Invalid username & Password");
}
dr.Close();
}
}