View Single Post
  #1 (permalink)  
Old May 14th, 2013, 06:07 PM
JeffG2583 JeffG2583 is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote