p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Help with basic authentication (http://p2p.wrox.com/showthread.php?t=90050)

JeffG2583 May 14th, 2013 06:07 PM

Help with basic authentication
OK, I'm very new to web developing and just want to create a basic web app for managing work requests. I can create the data access layer and get my queries the way I want, and even design the pages to return and update, etc. The problem I'm having is with authentication. I want to use the login control to authenticate to a simple SQL database. The DB is built with usernames, passwords and another column to identify the person. I have the login control calling a CheckLogin() function the checks the DB for the username and password and returns true/false depending on if their username and pw was found.

My question is... how then do I take this and use it on other pages to make sure the user is authenticated before loading the page? Here's that code:

Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim isAuthenticated As Boolean
isAuthenticated = CheckLogin(Login1.UserName, Login1.Password)
If isAuthenticated = True Then
Login1.DestinationPageUrl = ""
e.Authenticated = True
End If

If isAuthenticated = False Then e.Authenticated = False

Any and all help is GREATLY appreciated! What's taken me days to read about will hopefully take someone just a minute to help me understand. I want to avoid using the roles features if I can since it's just basic.

All times are GMT -4. The time now is 08:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.