Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 03:46 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default username/password creation of login page in asp

hello-

i am developing an application where the end user needs to login using their username and password in order to edit a record in a sql200 database. The username and password is stored in a table in the same sql200 database.

My question is this, and please forgive me if this is the wrong forum or a very simple question...but how can i validate the username/password prior to admiting the user to the page where they can edit the record? Is there a best practice out there ( or better yet an example) which can help me?

Any guidance would be appreciated.

thank you,

Mike



 
Old March 21st, 2005, 06:08 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

1..Apply JS validation to the fields where you ask for the UN and PW
2..Post variables to a page
3..Then Do something like:
-----------Assumes you have an created a connection (conn)-----------
<% 'form variables posted to this page (UN & PW)
   'is there a record in the DB that matches the variables
   sql = "SELECT id,uName,pWord FROM userTable WHERE uName = '" & trim(request.form("name")) & "' AND pWord = '" & trim(request.form("pWord")) & "';"
   'execute query
   set getInfo = conn.execute(sql)
   if getInfo.EoF then
      'details not found - chuck em out
      response.redirect("loginFailed.asp")
   else
     'details found - let em in
      response.redirect("loggedIn.asp?uId=" & getInfo(0) & "")
   end if
%>
-----------------------------------------------------------
Note : The ID of the user is in the getInfo(0) QS value

Wind is your friend
Matt
 
Old March 21st, 2005, 08:28 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Matt-

Thank you Thank you Thank you!! This worked perfectly.

I may ask your help again if I need help keeping the enduser's session alive thru the process which i plan to tackle next. :)

Many thanks once again in helping me to get this off the ground

- mike



 
Old March 21st, 2005, 08:38 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

NO worries - glad to help

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with login page creation neil.abachi07 ASP.NET 1.0 and 1.1 Basics 65 April 16th, 2008 11:47 PM
Regarding Username and password kuku_ashu Javascript How-To 0 January 4th, 2008 11:28 AM
username and password abhi_loveu2002 ASP.NET 2.0 Basics 1 December 14th, 2006 05:25 AM
Username and password Hennie Access 1 July 28th, 2006 12:43 AM
Login with username and password morpheus Classic ASP Basics 4 November 19th, 2003 11:54 AM





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