Hi. My clubsite is online now, thanks to help from this forum. I would like to be able to restrict access to events and maybe some other pages by roles. Right now it looks like there are three roles, Administrators, Members(anyone logged in) and Guests
(anyone not logged in). I'm familiar with how the classified starterkit controls access by using roles in the sitemap file. That doesn't seem to work with the clubsite. Would someone point me in the right direction to limit access to pages based on user
status or roles?
Are these pages in a separate folder or under the root folder directly? Sitemap trimming only hides the links to the pages in the menu, it won't prohibit access to the secured pages. You have to apply some sort of restriction separately. You can do that
by <location> tag in web.config file like this:
redwoodbev
Member
29 Points
166 Posts
Restricting Access to Pages by Roles
Jun 11, 2009 06:59 PM|LINK
Hi. My clubsite is online now, thanks to help from this forum. I would like to be able to restrict access to events and maybe some other pages by roles. Right now it looks like there are three roles, Administrators, Members(anyone logged in) and Guests (anyone not logged in). I'm familiar with how the classified starterkit controls access by using roles in the sitemap file. That doesn't seem to work with the clubsite. Would someone point me in the right direction to limit access to pages based on user status or roles?
Thanks, Bev
Club Starter Kit Roles Page Access
bullpit
All-Star
21838 Points
4822 Posts
Re: Restricting Access to Pages by Roles
Jun 11, 2009 07:26 PM|LINK
Are these pages in a separate folder or under the root folder directly? Sitemap trimming only hides the links to the pages in the menu, it won't prohibit access to the secured pages. You have to apply some sort of restriction separately. You can do that by <location> tag in web.config file like this:
<location path="SecuredFolder/SecuredPage.aspx"> <system.web> <authorization> <allow roles="Administrators, Users"/> <deny users="*"/> </authorization> </system.web> </location>Max
Let Me Google That For You!
redwoodbev
Member
29 Points
166 Posts
Re: Restricting Access to Pages by Roles
Jun 11, 2009 08:21 PM|LINK
Thank you so much. That worked like a charm! Bev
bullpit
All-Star
21838 Points
4822 Posts
Re: Restricting Access to Pages by Roles
Jun 11, 2009 08:24 PM|LINK
You are welcome.
Max
Let Me Google That For You!
jcb871
Member
2 Points
1 Post
Re: Restricting Access to Pages by Roles
Aug 05, 2009 03:19 AM|LINK
Thank you a lot for that code... :)
I need tyo show some message when the user is not authorized to view the page.
Now it automatically redirects to login page.
Thanks for help :)