So in page load you can check multiple roles
since u r using built in classes for login management, I would suggest you to store the page inside
a folder, then on that folder allow roles that u want to allow (u will have another web.config file inside newly created folder
to allow whatever roles you want to allow to users to access aspx pages inside that folder)
So in page load you can check multiple roles
since u r using built in classes for login management, I would suggest you to store the page inside
a folder, then on that folder allow roles that u want to allow (u will have another web.config file inside newly created folder
to allow whatever roles you want to allow to users to access aspx pages inside that folder)
I tried what u said its working fine in my development machine at hosting its not working why..?
what problem you have at hosting ?
obviously you have to setup properly with the hosting details (SQL server address, user id, password etc)
so I think if you have complete connection string for hosting, then you should use that to manage the web site, once it is
done, you can upload the data at hosting
I mean to say, on your local machine, change the connection string settings to point to server
Priya_here
Member
709 Points
1859 Posts
multiple roles to access single apsx page
Dec 14, 2012 10:16 AM|LINK
Hi..
1) I have three roles name 'First' ' Second' 'Three' so for one role i know this query for
if (Roles.IsUserInRole("First") == false) { Server.Transfer("Unauthorized.aspx"); }how to give multiple role in page load of aspx page...
2) I have allow the roles in my listbox so how to give single user to multiple roles..?
senthilwaits
Contributor
3832 Points
651 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 10:19 AM|LINK
You can use the following code snippet
Please refer
http://www.asp.net/web-forms/tutorials/security/roles/assigning-roles-to-users-cs
Senthil Kumar Sundaram
usman400
Contributor
3503 Points
721 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 10:21 AM|LINK
So in page load you can check multiple roles
since u r using built in classes for login management, I would suggest you to store the page inside
a folder, then on that folder allow roles that u want to allow (u will have another web.config file inside newly created folder
to allow whatever roles you want to allow to users to access aspx pages inside that folder)
Jack Hunt
Participant
1270 Points
713 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 10:21 AM|LINK
you have to take three column in your datatable role1,role2,role3 and set true or false value for it
and when user login then make three session role1,role2,role3 and set thier value in it and then check condition
if (session["role1"]=="true")
{
}
else if (session["role2"]=="true")
{
}
else
{
}
mit's Website
Mitesh N Vaishnav
Priya_here
Member
709 Points
1859 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 11:14 AM|LINK
I tried what u said its working fine in my development machine at hosting its not working why..?
Priya_here
Member
709 Points
1859 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 11:16 AM|LINK
Would you please tell me clear with code so that i can understand how it works?
usman400
Contributor
3503 Points
721 Posts
Re: multiple roles to access single apsx page
Dec 14, 2012 02:02 PM|LINK
what problem you have at hosting ?
obviously you have to setup properly with the hosting details (SQL server address, user id, password etc)
so I think if you have complete connection string for hosting, then you should use that to manage the web site, once it is
done, you can upload the data at hosting
I mean to say, on your local machine, change the connection string settings to point to server