Show Hide specific section of page based on User Type or Role in ASP.Net

Last Reply on Nov 24, 2014 03:51 AM By EmadKhan

Posted on Nov 24, 2014 01:31 AM

I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here. Thanks~

Posted on Nov 24, 2014 03:51 AM

at the time of Login Button Click :

1- Check the user type and save in session e.g.

if(UserType == "Student" )

{ Session["Prefix"] = "stud" }

else {Session["Prefix"] = "admin"}

then at those pages where you want to disable , on their page_load do this :

if(Session["Prefix"].ToString().Trim() == "stud") { LoginPanel.Enabled = false; }