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

Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 28, 2014, 10:47 PM EST
vishnu suresh53 reputationPosted Dec 28, 2014, 10:57 PM EST
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 28, 2014, 10:59 PM EST
is it returning correct value or not you have to check it .
vishnu suresh53 reputationPosted Dec 29, 2014, 2:14 AM EST
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 29, 2014, 2:16 AM EST
vishnu suresh53 reputationPosted Dec 29, 2014, 2:25 AM EST
Vikram AgrawalRank #4,713 · 329 reputationPosted Dec 29, 2014, 2:45 AM EST
can you post the code for User.IsInRole("vishnu"); method
then it will be easy to understood your problem
vishnu suresh53 reputationPosted Dec 29, 2014, 2:55 AM EST
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");
}
Harieswaran DRank #1,389 · 1.2K reputationPosted Dec 29, 2014, 5:11 AM EST