Password Protecting Some Text and Not Others
Posted on 2005-02-25
I have a very simple website that looks like this:
When a user clicks on a link, the link loads a user control and has a parameter that tells the user control what text it should get from the WebPages table of the database. Some of the text needs to be password protected (accessible to only a few users) and the rest can be accessible to anyone.
I plan to add a “Security” column to the WebPages table that indicates whether the page is password protected (1) or not (0). Whenever the user control loads a new page it’ll check if the “Security” column contains a 1 or a 0. If it contains a 1, the user control will check to make sure the user is logged in by looking for a cookie. If no cookie is present, it’ll redirect that user to the login page.
Is this the most efficient way to go about this or is there a more efficient or easier way?
I'm new to .NET programming so please make your response fairly detailed.