<asp:HyperLink ID="HyperLink27" runat="server" ForeColor="White"
NavigateUrl="~/Login.aspx">[Sign in]
Master Page.cs file:
protected void Page_Load(object sender, EventArgs e)
{
string role=(string)(Session["userauthentication"]);
if (Session["userauthentication"] != null)
{
HyperLink3.NavigateUrl = "E_scan_request_IP.aspx";
HyperLink9.NavigateUrl = "scheuler_innovation.aspx";
}
else if (Session["userauthentication"] != null)
{
HyperLink3.NavigateUrl = "E_scan_request_IP.aspx";
}
else if (Session["userauthentication"] != null)
{
HyperLink9.NavigateUrl = "scheuler_innovation.aspx";
}
}
Login Page cs:
protected void Button1_Click(object sender, EventArgs e)
{
string role = DropDownList1.Text;
string username = TextBox1.Text;
string password = TextBox2.Text;
con.Close();
con.Open();
cmd = new SqlCommand("select * from schedule_login where Role='" + DropDownList1.Text + "' and Username='" + TextBox1.Text + "' and Password='" +TextBox2.Text + "'",con);
rd = cmd.ExecuteReader();
if (rd.Read())
{
Session["userauthentication"] = role;
Session.Timeout = 1;
Response.Redirect("Home.aspx");
}
else
{enter code here
Session["userauthentication"]="";
}
}
there are different roles according to that different hyperlink should be enabled and disabled... i'm getting problem in master page while its not storing session instring role=(string)(Session["userauthentication"]); please help me with this since i'm new to asp.net