In Asp.net How Do I Make It So That Only Registered Users Can Access Certain Pages?

February 6th, 2010 by CTO WebOjO.com website designers Lahore Pakistan Leave a reply »

?

Advertisement

2 comments

  1. Rex M says:

    It’s quite simple – on the most basic level, you must create a user database; a login page that validates the users’ credentials against that database and then sets a session or cookie value that signifies that browser as being “logged in”. On your private pages, simply check to verify that session or cookie value is present; if not, redirect back to the login page.
    Obviously it can get much more complex, but I’m assuming you need to start with the basics since you’re asking about it on Y!A.

  2. Smutty says:

    The post above me works perfectly if you have nothing sophisticated.
    I tend to prefer custom code, however if you feel that your custom code might not be secure enough, you can check out “Membership and Role Management” in ASP.NET 2.0.
    ASP.NET 2.0 offers features such as Login Controls that facilitates what you’re asking for.