Howdy,
I’d like to create a website with c# and ASP.NET. This Website should feature a front end which is accessable by all visitors – and then I’d like to create a backend which is only accessibly after the user logged in … however I’m facing a couple problems since this is my first web project in C# and in general.
I think I have to create at least 3 classes:
Page – ( every page should inherit this page )
holds if the page should be an open or closed page
Loginpage
Membership Page
Checks if the user is really logged in and which user it is.
I have no clue if this is the right way to do it – and how I should do. I would be really grateful 4 help.
Take a look at the MembershipProvider. ASP.NET comes with some pre-rolled controls for logging users in and out, as well as several mechanisms for checking whether a user is logged in and what roles they have. You can secure resources programmatically by checking on what roles the current user has and make decisions in code, or in the web config by requiring specific user names and/or roles to access a given resource (such as a page).
Here’s an intro link to get you started:
http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx
Once you’re done getting a general feel for what the MembershipProvider is, here’s a video to walk you through setting up a SqlMembershipProvider:
http://www.asp.net/general/videos/how-do-i-set-up-the-sql-membership-provider