Important alert: (current site time 7/15/2013 11:57:37 PM EDT)
 

winzip icon

Update: Basic Authentication 2.5 [With FAQ]

Email
Submitted on: 10/1/2000 5:47:52 AM
By: Almar Joling  
Level: Beginner
User Rating: By 20 Users
Compatibility: ASP (Active Server Pages)
Views: 49356
author picture
(About the author)
 
     The orginal "Basic Authentication II" has been updated. Please vote! Update: -Added a FAQ page that should help you with some problems; -Did some code formatting; -Set Databases to nothing when they are't used anymore; -Also added a database in '97 format. Code standardly uses 2k format. -- The code will show the basic authentication dialog, and will verify the username/password the visitor entered with a database. If the username/password isn't found/incorrect it will redirect to an 'access denied' page. If the username/password are correct, the program will redirect to the 'welcome' page (which will also confirm that the user is authenticated). This code will also log the last login date/time and the total login count. 99.9% secure :o). Also includes a signup script...

 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :Update: Basic Authentication 2.5 [With FAQ]
'**************************************
Check the readme.txt file. Also read the FAQ file if you have any problems
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/3/2000 9:11:08 PMmango

This code works wonderfully, I am now using it on our companys web site in conjunction with ssl. Minor recoding need to be done for our use, VERY useful and wonderfully simple, This code gets my vote
(If this comment was disrespectful, please report it.)

 
10/4/2000 3:38:04 AMAlmar Joling

Thanks!
If you have any ideas that should be added, please tell me.
(If this comment was disrespectful, please report it.)

 
10/5/2000 4:12:39 PMMark DeVito

Great code. As a
(If this comment was disrespectful, please report it.)

 
10/20/2000 9:39:33 AMcliff

The login box keeps coming up over and over even after I have logged in with a valid ID? Is there something I need to change on the server side or in the code or something? The signup works fine and writes to the database. Please help! Thanks.
(If this comment was disrespectful, please report it.)

 
11/15/2000 2:12:05 PMDarrin

I tried to use it but was never given the basic authentication dialog to enter a username or password. It automatically went to the "Access Denied" page. Could you help me out???
Thanks!!
(If this comment was disrespectful, please report it.)

 
11/27/2000 8:23:48 AM//enamb/

This code is full of holes, juh, en neem voortaan ff een engels screenshot :-)
(If this comment was disrespectful, please report it.)

 
11/28/2000 9:35:13 AM(---Wizard---)

This code works great, just make sure you enable basic authentication on your web server, remove anonymous authentication, and don't use NTCR authentication unless all your clients are using IE.
(If this comment was disrespectful, please report it.)

 
12/23/2000 8:36:23 PMthor

I have a bug to report on your login script.
First I login with my username and password in the password dialog.
And after that logout.
And then I press login again.
The username that I logged in with before I logged out is displayed in the username
field and the password field is blank.
If I press abort button in the password dialog.
I get a
(If this comment was disrespectful, please report it.)

 
12/23/2000 8:39:00 PMthor

"401 Unauthorized" and if I then press refresh I will be logged in as the
person that logged in before me without knowing his password.
Please help me fix that.It is bugging me really.
(If this comment was disrespectful, please report it.)

 
12/23/2000 9:40:30 PMPG

Does anyone know how to get this code to work while running Windows 2000 or NT. The "WWW-Authenticate" dialog also prompts for a domain name in these environments. Is there any way to get around this and just have the User & Pass, like the example above? Any help appreciated.
(If this comment was disrespectful, please report it.)

 
12/29/2000 12:14:02 PMels

I like this routine, it gives appearance of being more secure than form. Select Basic, De-select NT CR auth in Internet Service Mgr to lose the domain tbox.
(If this comment was disrespectful, please report it.)

 
1/23/2001 5:54:04 PMNew(sort of)

How do i make this work in frontpage? I know vb and stuff but new at web page scripts? E-mail me @ codec2000inc@aol.com
(If this comment was disrespectful, please report it.)

 
2/16/2001 3:26:14 AMCraig

I haven't been able to open up the 'user.mdb' database. I get 'unrecognised database format'. I'm using Access 97. What format is user.mdb in? Access 97 should be able to read Access 2000 database's. Please email cdyer@one.net.au with any info.

TIA
(If this comment was disrespectful, please report it.)

 
2/17/2001 5:44:07 PMLewis@Moten.com

it seems that IIS is trying to authenticate me against NT User Accounts before it will let me visit that web page. Is there a header type to instruct IIS not to authenticate against itself, but still let the browser pass UserName/Password in a server variable?
(If this comment was disrespectful, please report it.)

 
3/8/2001 7:16:59 PMAnon.

mango-
try changing all every 'Response.Write' to a 'Response.Redirect'. That way you can personalize the 401, Access Denied and all the other errors. This has worked well for me. : )
(If this comment was disrespectful, please report it.)

 
3/24/2001 5:15:01 PMandy

The login box keeps coming up over and
over even after I have logged in with a
valid ID? Is there something I need to
change on the server side or in the
code or something? The signup works
fine and writes to the database. Please
help! Thanks.
(If this comment was disrespectful, please report it.)

 
7/12/2001 2:23:15 AMAlmar Joling

It's time I made a small "faq" for
this... I recently discovered *very*
much replies on this code, and my other
ASP code, but I never checked that
email account anymore. I'm very
sorry that I never replied to any of
your messages.


(If this comment was disrespectful, please report it.)

 
10/14/2001 9:29:56 PMTom Chr Ugland

I cant get it to work on win2k, i just get bas username or password, and i have deselected integrated windows authentication and selected basic authentication. What more do i have to do?
(If this comment was disrespectful, please report it.)

 
10/31/2001 8:48:14 AMAnton

I got same problem as Darrin


(If this comment was disrespectful, please report it.)

 
10/31/2001 8:49:32 AMAnton Lukmandjaja

I tried to use it but was never given
the basic authentication dialog to
enter a username or password. It
automatically went to the "Access
Denied" page. Could you help me
out???
Thanks!!

PS: I use Win2000 Professional

(If this comment was disrespectful, please report it.)

 
11/6/2001 2:29:02 PMkik333

ummm, your code looks great,
but we are all having the same problem. I too am getting the auth dialogue box popping up over and over. Is there a faq or can u at least answer how to help that problem. Thanks Almar!

(If this comment was disrespectful, please report it.)

 
8/9/2002 12:29:48 PMchrisorm

Can this code (Basic Authentication 2.5) be used to allow users into an Intranet site using their NT Username & Password? Without copying the information to a new database?

Great code as it is by the way!

Cheers
Chris
(If this comment was disrespectful, please report it.)

 
1/29/2003 3:03:46 PM

I would like to inform you about a bug. After logging in when i logout and then relogin and in the authentication box id but password empty when i press cancel "401 Unauthorised" is displayed. At this moment if i press Refresh then i will get loggid in as if i have entered a valid id and password. Please reply to fix this bug

(If this comment was disrespectful, please report it.)

 
2/7/2003 7:13:10 AM

Nice code but I cannot get it work on win2k. I never get a popup login window. It directly goes to access denied page. Im using windows 2000. I guess it does not work for windows 2000.
Any new version for win2k.
(If this comment was disrespectful, please report it.)

 
4/29/2003 10:55:59 AM

This code working fine on PWS IIS under windows 2K. But when upload to unix server, I found out even provide the right username and password, that always redirect to error pages.
Please give a piece of advice....
Expert said Case sensitive on unix server....
Thanking in advance.
Please email leolee782003@yahoo.com
(If this comment was disrespectful, please report it.)

 
7/5/2003 8:18:06 PM

Works Great!! Just check out the FAQ! Solved my config. issue immediately!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.