I have web program in which I want to add users and admin by user access roles. I have created admin roles and users. when I login and go the home page I want to hide some panels for users and show it for admin.
I have use this code
Panel3.Visible = User.IsInRole("vishnu");
but it is not working
I have used windows authentication.
pls help
Harieswaran DPosted Dec 29, 2014, 10:11 AM
vishnu sureshPosted Dec 29, 2014, 7:55 AM
this is my login page
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
Response.Redirect("Default2.aspx");
}
this is my defaul2aspx page contain code
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = User.IsInRole("vishnu");
}
Vikram AgrawalPosted Dec 29, 2014, 7:45 AM
can you post the code for User.IsInRole("vishnu"); method
then it will be easy to understood your problem
vishnu sureshPosted Dec 29, 2014, 7:25 AM
Manish Kumar ChoudharyPosted Dec 29, 2014, 7:16 AM
vishnu sureshPosted Dec 29, 2014, 7:14 AM
Manish Kumar ChoudharyPosted Dec 29, 2014, 3:59 AM
is it returning correct value or not you have to check it .
vishnu sureshPosted Dec 29, 2014, 3:57 AM
Manish Kumar ChoudharyPosted Dec 29, 2014, 3:47 AM