MIS 333K - ASP2 login help - Fall 2009 - Byars

MIS 333K - ASP2 login help - Fall 2009 - Byars - ).ToString...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the code behind the Login button shown in class. There are two versions below (see comments at start of each version) This version uses two functions, one to check user name and one to check password. You have to write the class functions to do this. Option Strict On Partial Class LoginNoCode Inherits System.Web.UI.Page Dim DB As New ClassCustomerDB Dim Format As New ClassFormat Protected Sub btnLogin_Click( ByVal sender As Object , ByVal e As System.EventArgs) Handles btnLogin.Click ' validate input - can't be blank ' Check Username If DB.CheckUserName( Me .txtInUsername.Text) = False Then ' error message lblmsg.Text = "bad username" Exit Sub End If ' now check password If DB.CheckPassword( Me .txtInPassword.Text) = False Then lblmsg.Text = "bad password" Exit Sub End If ' it is a good login, so ' make panel visible Me .panel1.Visible = True ' get customer's record and show on form Me .txtLastName.Text = DB.CustDataSet.Tables( "tblcustomers" ).Rows(0).Item( "lastname"
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ).ToString ' . .. do the rest of the fields. End Sub This version uses ONE function to check both the username and password. You have to write the class function to do this. Option Strict On Partial Class LoginNoCode Inherits System.Web.UI.Page Dim DB As New ClassCustomerDB Dim Format As New ClassFormat Protected Sub btnLogin_Click( ByVal sender As Object , ByVal e As System.EventArgs) Handles btnLogin.Click ' validate input - can't be blank ' check username and password with one function If DB.CheckLogin( Me .txtInUsername.Text, Me .txtInPassword.Text) = False Then lblmsg.Text = "bad login" Exit Sub End If ' it is a good login, so ' make panel visible Me .panel1.Visible = True ' get customer's record and show on form Me .txtLastName.Text = DB.CustDataSet.Tables( "tblcustomers" ).Rows(0).Item( "lastname" ).ToString ' . .. do the rest of the fields. End Sub...
View Full Document

This note was uploaded on 11/29/2010 for the course MIS 333k taught by Professor Staff during the Fall '08 term at University of Texas at Austin.

Page1 / 2

MIS 333K - ASP2 login help - Fall 2009 - Byars - ).ToString...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online