Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How can I apply role to users within the code without using ASP.net config? Can it be done to a table of users with out going through each one. I have like 5000 users in one table and the same in another.
Posted

1 solution

How can I apply role to users within the code without using ASP.net config?
I assume you don't want to embed the username, passwords and membership information inside the web.config. You can use the provider model to arrange authentication & authorization, it takes away much of the donkey work
There is a good series on doing this with SQL server here[^]. In this case you can run SQL against the database to set everyone up. I think that answers the other parts of your question, but I'm not fully clear I understand it.

There are other providers available with .net, so you are not restricted to SQL, you can extend these and even implement your own.
 
Share this answer
 
Comments
Computer Wiz99 1-May-13 8:01am    
Thanks Keith Barrow. The other question I have it that that SQL database was made with asp.net using C#. I made three tables: CEO table, IALO Table and a Security Table. The CEO and IALO tables has user records in them. What I am doing is trying to get my code to where it can read at login, these tables to see if the user exists. If the user exists then they can login, if not they can't login. After login the role can then let them see a certain page. Is this hard to do within the C# code?
Keith Barrow 1-May-13 8:09am    
You can extend the provider base classes to fully implement you own functionality (including custom SQL) video here: http://www.asp.net/web-forms/videos/how-do-i/how-do-i-create-a-custom-membership-provider
Computer Wiz99 1-May-13 8:25am    
Thanks. This helps out. Would you like to see the code I have just in case I need to change anything?
Keith Barrow 1-May-13 9:38am    
Not really. You should be able to make pretty much anything rational fit.
Computer Wiz99 1-May-13 9:35am    
Any chance this is in C#? I download the zip file but the video is in VB not C#.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900