Read about form based authentication in ASP.NET here.
http://www.15seconds.com/i
http://www.15seconds.com/i
Now you don't have to do this for the whole site but in .NET you can do it per folder. Put the login.aspx in Admin dir and that dir should be accessible to authenticated users only. Send the user to Admin/Login.aspx when they want to login. After successful login do the things that is shown in the article and the User will be set. Redirect back to the previous folder and aspx. In those aspx put a simple code in Page_Load like this
Sub Page_Load()
If User.Identity.IsAuthentica
'User is authenticated - Display the edit buttons
Else
'User is not authenticated - Hide the edit buttons
End If
End Sub
Main Topics
Browse All Topics





by: micamediaPosted on 2003-07-30 at 15:48:49ID: 9040413
Here's is what I would do, maybe not what you are looking to do.. but maybe it is..
rea/index. asp")
1. Create a special directory or set of pages for admins that have the admin editing controls on them.
2. Make the index of that directory have an admin login that does something like this:
user = request.form("user")
password = request.form("password")
'lookup in the db if it's the right password.
'if it's the right password set a session:
if password_correct then Session("user_loggedin") = true (or you can set it to the user id who just logged in)
3. Create an include file.. call it "admins.asp". with the following:
if Session("user_loggedin") = "" then response.redirect("/admina
4. include the admins.asp file at the very type of each and every admin page. This will force them to go back to the admin login page if they are not logged in.
In the main app just have a like to the admin login page something like "admins login here"..
there will be no way anyone can access any of the admin pages without logging in first, because you can only set the session variable on the server side.
Is this what you are trying to do? (if not let me know)