Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

authenticating folders

Status
Not open for further replies.

mrp9090

Programmer
May 22, 2006
71
GB
I have some code of my own where I am checking a username/password against a database for login, I am not using any of the login controls etc. What I want to do next is to create a folder for my admin pages and make it only available to administrators. At login I set an int which if an admin logs in is set to 2, otherwise it is set to 1 or 3. So what I want to be able to do is check if this int is 2, and if so set a global value which means that the admin pages can be viewed, if a non-administrator tries to access the pages they get redirected. How do I do this?
 
Set a session variable when the user logs in, check it's value on the relevant admin page(s) and if it's correct show the page else redirect the user.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Can I not set a role for the user on login and then in web.config configure it so that only people in certain roles can view any of the pages in the admin folder?
 
Yes you can but your question asked how to do it with an integer value which is why I said to use session variables.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
You'll have to use Forms Authentication. There are lots of examples on MSDN and google that should come in handy. Some of the basics are covered here:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top