[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How does the Roles system in asp.net Identity work with Web forms?

Posted on 2014-08-09
2
Medium Priority
?
1,296 Views
Last Modified: 2014-08-11
I would like to see samples of how the roles system works with Web Forms in the new asp.net Identity system.  All I can find are MVC samples,  absolutely nothing with Web Forms.  I Would like to know, how to set the roles restrictions in folders, and prevent access to specific pages?  Does it work the way it has always worked,  you set folder permissions in the webcconfig in each directory?

I Appreciate the help,
0
Comment
Question by:bmanmike39
2 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 2000 total points
ID: 40251923
Please refer to this link:
http://msdn.microsoft.com/en-us/library/ff647401.aspx

So, some things:

You need a role manager. ASP .NET provides one for us that you can tie into, but I prefer to roll my own. Simply create a class the implements the RoleProvider base class.  All you really, really need to implement is one Method: IsInRole(..) (I think that's it).

Then, tie the new RoleProvider you created into the application via the web.config, as described in the article. Then, create your roles and assign them to the users in any way you want. The IsInRole() method will check using the process you created.

I actually did this by using the ApplicationState as the Role holder. I put the username and role in the Application State when they log in. Then, I check the Application State when IsInRole is processed.
0
 

Author Closing Comment

by:bmanmike39
ID: 40254827
thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month20 days, 9 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question